[英]IE11 div height is not calculated correctly
我有以下代碼片段 ,在chrome上可以完美呈現,但是在IE11上, .wrapper
div元素的高度未正確計算。
IE11
的修復需要什么? 我曾嘗試四處尋找修復程序,但找不到能完全解決此問題的修復程序。
從您的.container
css
刪除flex:1
解決了該問題
刪除顯示:flex; flex; 1 CSS線用於選擇器.container
body { background-color: gray; } .wrapper { display: flex; flex-direction: column; flex: 1; flex-wrap: nowrap; background-image: linear-gradient(90deg, #f17e5d 35%, #f6d365 100%); padding: 80px 0px; padding-left: 10px; padding-right: 10px; justify-content: center; } .container { background: #fff; padding: 20px; border-radius: 4px; justify-content: center; align-self: center; width: 455px; top: 5px; position: relative; flex-direction: column; } .headline { padding: 20px; background: #fff; margin-bottom: 20px; border-radius: 4px; } .orderedList { font-style: italic; font-size: 16px; color: black; padding: 18px; position: relative; top: -28px; margin: 0; } .listItem { padding: 0 5px; } .listContent { padding: 1px; font-style: normal; color: black; margin-left: 5px; white-space: pre-line; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head> <body> <div class="headline"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to . Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to .Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to . </div> <div class="wrapper"> <div class="container"> <ol class="orderedList"> <li class="listItem"> <p class="listContent"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to </p> </li> <li class="listItem"> <p class="listContent"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to </p> </li> <li class="listItem"> <p class="listContent"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to </p> </li> <li class="listItem"> <p class="listContent"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to </p> </li> </ol> </div> </div> </body> </html>
作為https://caniuse.com/#search=flexbox (請參閱已知問題):
在IE10和IE11中,如果容器具有min-height但沒有顯式的height屬性,則顯示:flex和flex-direction:列的容器將無法正確計算其flexed子代的大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.