CSS 圆角
我有三张图片。一张在左边,一张在右边,一张在中间。 这就是我所拥有的:
<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"> </div>
我看不到左侧和右侧的图像。只是重复的 backer_alt.gif。我做错了什么? 谢谢
编辑 这个版本的工作原理:
<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"> </div>
I have three images. One for the left, one for the right and one for the middle.
This is what i have:
<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"> </div>
i cannot see the left and the right images. just the repeating backer_alt.gif. what am i doing wrong?
thx
edited
this version works:
<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"> </div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
.tr
的margin
设置为 10px,而不是其padding
。您可能还需要将.br
上的background-position
设置为右上角
,以便它显示在正确的位置。Try setting
.tr
’smargin
to 10px instead of itspadding
. You also probably need to set thebackground-position
on.br
totop right
so it appears in the correct place.正如诺亚所说,添加正确的左边距和右边距。 .tr 的右侧,取决于角宽度,
将会出现:
As noah says, adding the correct margin left & right to the .tr, depending corner width,
will make it appears: