如何 - 边框右侧的 CSS 背景



我在下面的示例中将图像设置为 #left 的右侧边框时遇到问题。 目前出现边框,但它在右侧大约 200px,而不是右侧 500px。

知道出了什么问题吗?

谢谢!

<html>
<STYLE type="text/css">
#wrapper, #left, #right, .sub_box
{ border: 1px solid black; }
.sub_box
{ float:left; }
#left
{ background: url("dots.gif") right repeat-y; }
</STYLE>
<div id="wrapper" style="width:882px">
<div id="left" style="width:500px;float:left">
    <div class="sub_box" style="width:200px">
    <p>sub box</p>
            </div>
    <div class="sub_box" style="width:200px">
            <p>sub box</p>        
            </div>
    <div class="sub_box" style="width:200px">
    <p>sub box</p>
            </div>
</div>
<div id="right" style="width:200px;float:right">    
    <p>Right column here</p>
    </div>
</div>   
</html>

试试这个...

background: url("dots.gif") 500px 0px repeat-y;

或者根据需要进行调整。

最新更新