CSS:应用背景,全宽度的div具有固定宽度 [英] CSS : Apply background to full width in a div with a fixed width

查看:145
本文介绍了CSS:应用背景,全宽度的div具有固定宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面在有限的宽度除以行。 (< D​​IV 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

这篇关于CSS:应用背景,全宽度的div具有固定宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆