【发布时间】:2014-03-06 16:39:02
【问题描述】:
我正在尝试创建多色背景。
我希望整个背景为蓝色,某些容器中的部分为红色。我希望红色一直从页面的一侧到另一侧,而没有浏览器可能呈现的任何空白。这是我所拥有的:
HTML:
<div class="Blue">
Here is one color
</div>
<div class="Red">
Here is one color
</div>
<div class="Blue">
Here is one color
</div>
<div class="Red">
Here is one color
</div>
CSS:
.Blue {
width:100%; /* I want the width of the background to be 100% of the page ?*/
height: 30%; /* I want the height of the background container to be 30% of the page? */
background-color: blue;
}
.Red {
width:100%;
height: 30%; /*The next 30% of the page ? */
background-color: red;
}
http://jsfiddle.net/4DXDX/ 边缘偏移,两侧有白边。
如何让颜色从一个边缘一直到另一个边缘?将适当的颜色放在 div 标签中是正确/或有效的方法吗?
下面是我要创建的背景图像。
【问题讨论】:
-
google for css reset (or normalize) ...或者看看这个问题stackoverflow.com/questions/99643/…
标签: css html background