CSS:应用背景,全宽度的div具有固定宽度
问题描述:
我的页面在有限的宽度除以行。 (< DIV CLASS ='行'>
)
我想申请一个背景(彩色)每行,但我想回到地面没有考虑到div的宽度限制,是有办法做到这一点?
My page is divided in rows with limited width. (<div class='row'>
)
I would like to apply a background (color) to each row, but I would like the back ground not to take into consideration the width limit of the div, is there a way to achieve this ?
谢谢!
答
是你要去这样的事情?它会更容易回答你的问题,如果你提供了一个小提琴或至少一些code,所以我们可以帮你解决问题。
Were you going for something like this? It'd be easier to answer your question if you provided a fiddle or atleast some code so we can help you with your problem.
我来此解决方案:
<div class="row1">
...
</div>
<div class="row2">
...
</div>
结果
.row1 {
background-color: red;
width: 100%;
height: 50%;
}
.row2 {
background-color: pink;
width: 100%;
height: 50%;
}
您可以在这里运行: 的jsfiddle
You can run it here: JSFiddle