![](/img/trans.png)
[英]Issue in IE11 want flex-content-item to occupy full width same as table
[英]Flex item width can not work in IE11 when container have right scrollbar
這是一個例子
.FlexContainer { background: hsla(0,0%,0%,.1); display: flex; flex-direction: column; max-height: 220px; margin: 10px; padding: 20px; width: 300px; overflow-y: auto; } .FlexItem { background: hsla(0,0%,0%,.1); width: 80%; margin: 2px; padding: 6px; word-break: break-all; white-space: normal; cursor: pointer; } .FlexItem:hover{ background-color: red; }
<html> <head> <title>demo</title> </head> <body> <div class="FlexContainer"> <div class="FlexItem"> The contents is short in IE11. </div> <div class="FlexItem"> The contents is long - inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> <div class="FlexItem"> The contents inside of this box are overflowing their container in IE11. </div> </div> </body> </html>
在chrome中可以正常工作
但是在IE11中,這不是我期望的。 IE11無法正常工作
僅當容器高度小於fex項並設置溢出-y:auto / scroll時,才會發生此問題。
有誰能幫助我找到問題的原因?
感謝您的幫助。
Internet Explorer需要您指定子代的flex值。 嘗試添加屬性flex: 1 0 auto;
到FlexItem
類
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.