我有一个网站,我想改变它的背景。我想把背景放在顶部和底部。CSS多个背景
这里是CSS代码:
div.bg_top { background-image: url('bg_top.jpg'); background-repeat: no-repeat; background position: top center; } div.bg_bottom { background-image: url('bg_bottom.jpg'); background-repeat: no-repeat; background position: bottom center; }
HTML代码:
<div class="bg_top"> <div class="bg_bottom"> Content Here. </div> </div>
是正确的?
实际上应该是'center top'。水平的首先,然后是垂直的。 – DisgruntledGoat 2010-03-19 12:49:29
@Disgruntled山羊 - 对不起,现在修复。大多数浏览器会按照任意顺序正确渲染它,因为这是一个常见的错误。 – 2010-03-19 15:23:13
你是对的 - 对于字符串值来说,这是真的,因为不存在模棱两可的可能性('top'显然是垂直的)。虽然顺序对数字值是至关重要的。 – DisgruntledGoat 2010-03-20 01:21:24