Bootstrap 4 alignment in IE 11

瘦欲@ 提交于 2020-07-09 05:22:39

问题


I'm converting one of my websites from AngularJs / Bootstrap 3 to Angular 6 / Bootstrap.

In Chrome and firefox, and edige, my modal looks like this:

However, in IE11

The code:

<div class="container">
    <div class="modal-header">
    </div>
    <div class="modal-body">
      <form [formGroup]="loginForm" (keydown.enter)="onKeydown($event)">
          <div class="row form-group">
              <div class="col-12">
                  <input type="email" class="form-control" placeholder="Email" formControlName="userName" required autofocus />
                  <p *ngIf="!isValidUserName" class="help-block alert-danger">Invalid Username</p>
              </div>
          </div>
          <div class="row form-group">
            <div class="col-12">
                <input type="password" class="form-control" placeholder="Password" formControlName="password" required />
                <p *ngIf="!isValidPassword" class="help-block alert-danger">Invalid Password</p>
            </div>
          </div>
      </form>
    </div>
    <div class="modal-footer">
        <div class="grid">
            <div class="row">
                <div class="col-12">
                    <button class="btn loginBtn" (click)="login(userName.value, password.value)">
                        Login
                    </button>
                    <p *ngIf="loginError" class="help-block alert-danger">{{ loginError }}</p>
                </div>
            </div>
            <div class="row form-group">
                <div class="col text-center">
                    <label class="forgotPasswordLink" (click)="openForgotPasswordModal()">
                        Forgot password?
                    </label>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-12 col-md-6">
                    <button type="button" (click)="googleLogin()" class="btn btnGoogle googleIcon">
                        <span class="button-text">Login with Google</span>
                    </button>
                </div>
                <div class="col-12 col-md-6">
                    <button type="button" (click)="linkedInLogin()" class="btn btnLinkedIn linkedinIcon">
                        <span class="button-text">Login with LinkedIn</span>
                    </button>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-12 text-center">
                    Don't have an account? <a (click)="signUp()">Sign up</a>
                </div>
            </div>
        </div>
    </div>
</div>

I took a look on github, but none of those solutions seem to work to the best of my knowledge, is there a way to fix this inconsistency at a site level?


回答1:


Instead of using container can you try using container-fluid

It looks like it may have do to some width:auto styling? Bootstrap 4 IE 11 does not work

If you're looking at the site side-by-side on IE and Chrome you can use the F12 dev tools to look at the elements and styles, you just have to find the element/styling that is rendering differently.




回答2:


.container,.modal-header,.modal-body,modal-footer, input{
width: 100% !important;
}


div{
display:block;
float:left;
}


来源:https://stackoverflow.com/questions/53216139/bootstrap-4-alignment-in-ie-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!