css round corners



我有三张图片。左边一个,右边一个,中间一个。这是我的:

 <style type="text/css">
 img {border:0}
.bl {background: url(images/backer_left.gif) top left no-repeat; height:47px; }
.br {background: url(images/backer_right.gif) top right no-repeat; height:47px;}
.tr {background: url(images/backer_alt.gif) ; margin:0 4px 0 4px; font-size:12px; height:47px;}
.trText { padding:10px; } 
.clear { clear:both; }
</style>
<div class="bl">
  <div class="br">
    <div class="tr">
        <div class="trText">lay lay lomm</div>
    </div>
   </div>
</div>  
<div class="clear">&nbsp;</div>  

我看不见左边和右边的图像。只是重复的backer_alt.gif。我做错了什么?thx

编辑

 <style type="text/css">
 img {border:0}
 .bl {background: url(images/backer_left.gif) top left no-repeat; height:47px; }
 .br {background: url(images/backer_right.gif) top right no-repeat; height:47px;}
 .tr {background: url(images/backer_alt.gif) ; margin:0 4px 0 4px; font-size:12px; height:47px;}
   .trText { padding:10px; } 
 .clear { clear:both; }
 </style>
<div class="bl">
    <div class="br">
        <div class="tr">
            <div class="trText">lay lay lomm</div>
        </div>
    </div>
 </div>  
 <div class="clear">&nbsp;</div>  

尝试将.trmargin设置为10px而不是padding。您可能还需要将.br上的background-position设置为top right,以便它出现在正确的位置。

正如noah所说,添加正确的margin left &Right to。tr,根据角的宽度,将使它出现:

.bl {background: url(images/backer_left.gif) no-repeat left top; }
.br {background: url(images/backer_right.gif) no-repeat right top; }
.tr {background: url(images/backer_alt.gif) repeat-x; margin:0 10px; padding:10 0; }

最新更新