2012-04-26 203 views
0

我在下面的示例中将图像设置为右边框到#left时出现问题。目前边框出现,但它的右侧约为200px,而右侧为500px。如何 - 右边框的CSS背景

任何想法发生了什么问题?

谢谢!

<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> 
+0

也许你错过了«top»?背景:url(“dots.gif”)right top repeat-y; – podeig 2012-04-26 11:24:53

+0

@rix尝试我的答案我认为这将解决您的问题。 – 2012-04-26 11:29:07

+0

嗨,感谢您的回复,但请尝试一下代码。这是行不通的!! – rix 2012-04-26 11:41:57

回答

0

试试这个...

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

或调整,只要你想。

+0

同意这应该工作。只有当我使用位置时:我是否看到边框。使用x,y坐标似乎不起作用..? – rix 2012-04-26 12:07:15

+0

@rix尝试从右侧,用户490px或498px减少其位置,以满足您的要求... – 2012-04-26 12:19:59

+0

对此的答案是使用背景大小。使用它,我得到它的工作。用我的代码试试你的答案,你会发现它不起作用。 – rix 2012-04-26 12:30:01