简体   繁体   English

Internet Explorer 11中的页脚中未正确包含元素

[英]Elements are not properly contained in card-footer in Internet Explorer 11

I have created a form that is contained in a Bootstrap 4 Card as follows: 我创建了一个包含在Bootstrap 4卡中的表单,如下所示:

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="row card"> <div class="col-12 card-body"> Example text in the card body </div> <div class="col-12 card-footer"> <div class="row"> <div class="alert alert-warning col-12">Example alert box</div> </div> <div class="row form-group"> <div class="col-6"> <button type="button" class="btn btn-block btn-primary">Save form</button> </div> </div> </div> </div> </div> 

The usual content goes in the div.card-body , I placed an alert box as well as my "Save form" button in the div.card-footer . 通常的内容放在div.card-body ,我在div.card-footer放置了一个警告框以及“保存表单”按钮。

This works in Chrome 63 and Firefox 58. However in Internet Explorer 11 the save button and alert are not properly contained within the card footer, they overflow the div ( screenshot ). 这在Chrome 63和Firefox 58中有效。但是,在Internet Explorer 11中,存储卡页脚中未正确包含保存按钮和警报,它们会使div溢出( 屏幕截图 )。

How can I fix this? 我怎样才能解决这个问题?

The issue can be resolved by removing the col-12 class, which I used in combination with card-footer : 可以通过删除col-12类来解决该问题,该类与card-footer结合使用:

<div class="col-12 card-footer">

becomes

<div class="card-footer">

Bootstrap's col-12 class adds this CSS Bootstrap的col-12类添加了此CSS

-ms-flex: 0 0 100%; 
flex: 0 0 100%;

to the div . div Toggling these CSS definitions, or replacing the 3rd argument ( flex-basis ) 100% with auto or a fixed value, seem to fix this this particular issue as well, although I'm not sure why and what the side-effects might be. 切换这些CSS定义,或用auto或固定值100%替换第三个参数( flex-basis ),似乎也可以解决此特定问题,尽管我不确定为什么会产生什么副作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM