0
我嘗試了很多不同類型的clearfixes,但都沒有工作。我正在嘗試製作一個全寬視頻標題,其中包含文本,但您也可以向下滾動。這是我有:Clearfix不能在div中處理視頻
HTML:
<div>
<div style="width: 100%; position: relative;" class="video-container clearfix">
<video autoplay loop style="width: 100%; position: absolute; top: 0px; left: 0px;">
<source src="http://demosthenes.info/assets/videos/polina.webm" type="video/webm">
<source src="http://demosthenes.info/assets/videos/polina.mp4" type="video/mp4">
</video>
<div class="col-md-12" style="text-align: center;">
<h1>HI</h1>
<h1>HI</h1>
<h1>HI</h1>
</div>
</div>
<div>
<h3>TEST</h3>
<h3>TEST</h3>
<h3>TEST</h3>
</div>
</div>
CSS:
.clearfix:after {
content: " ";
display: table;
clear: both;
}
我想HI
的出現在視頻(工作)的前面,但我想TEST
要出現在視頻下方,但現在他們不這樣做,因爲video-container
比視頻高度短得多。
爲什麼我的clearfix不起作用?
Ehm,你只能使用clearfix來清除浮點數,而不是絕對位置。 –