我需要使這個工作在IE10瀏覽器。我認爲顯示器的柔性不被IE10支持。 我的要求是.line2和.line3CSS:防止2個元素斷裂和重疊
<div class="line2"></div>
<div class="line3"></div>
應該總是在同一行。我已經嘗試過使用顯示浮動。但我無法完成這項要求。當屏幕寬度減小而不必顯示水平滾動條時,不應該發生中斷。下面
是筆 codepen link
我需要使這個工作在IE10瀏覽器。我認爲顯示器的柔性不被IE10支持。 我的要求是.line2和.line3CSS:防止2個元素斷裂和重疊
<div class="line2"></div>
<div class="line3"></div>
應該總是在同一行。我已經嘗試過使用顯示浮動。但我無法完成這項要求。當屏幕寬度減小而不必顯示水平滾動條時,不應該發生中斷。下面
是筆 codepen link
正如@提到divine,您可以使用吐溫語法,display: -ms-flexbox;
本文就CSSTricks解釋它凌晨:Using Flexbox
.page-wrap {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
然後,以控制欄寬度:
.main-content {
width: 60%;
}
.main-nav,
.main-sidebar {
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
對於IE10您可以嘗試display: -ms-flexbox;
,但如果不能代替width: 500px;
,則.line2
和.line3
嘗試使用百分比。 在這種情況下給他們一個width: 50%;
。請參閱代碼示例如下:
.header {
background-color: red;
}
.line1 {
background-color: blue;
}
.line2 {
background-color: orange;
float: left;
width: 50%;
}
.line3 {
background-color: violet;
float: left;
width: 50%;
}
.footer {
clear: both;
background-color: green;
}
<div class="container">
<div class="header">
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 make a type specimen book.
</div>
<div class="line1">
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div class="line2">
There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum,
you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary
of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
</div>
<div class="line3">
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions
from the 1914 translation by H. Rackham.
</div>
<div class="footer">
If you use this site regularly and would like to help keep the site on the Internet, please consider donating a small sum to help pay for the hosting and bandwidth bill. There is no minimum donation, any sum is appreciated - click here to donate using
PayPal. Thank you for your support.
</div>
</div>
希望這有助於!
'display:-ms-flexbox;'for IE 10 – Sankar