[英]Text going out of the container div
CSS代碼:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width: 100%;
color:#fff;
height: 100%;
}
html代碼:
<div class="container" style="border:1px solid #000;">
<div class="row">
<div class="col-md-12">
<div id="overlay">Overlay</div>
Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it. Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it. Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it.
</div>
</div>
</div>
出於某些原因,我無法在容器中顯示背景覆蓋。 查看演示: http : //www.bootply.com/PJiifhEI8u
只需添加top:0;
left:0;
定位到CSS:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width: 100%;
color:#fff;
height: 100%;
top:0;
left:0;
}
根據您的評論進行更新:
將填充物添加到覆蓋層的一種方法是使用calc使覆蓋層的30px小於100%,然后添加15px的左邊距以使其居中:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width:calc(100% - 30px);
color:#fff;
height: 100%;
top:0;
left:0;
margin-left:15px;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.