【发布时间】:2011-08-09 13:06:00
【问题描述】:
在这种情况下
li {background: url("../img/grey-arrow-next.png") no-repeat right center;
border-bottom: 1px solid #D4E8EB}
我希望 20px 在背景图像之前的右侧有空格,我不能在 li 上留出空白,因为 border 应该触及边缘。
所以我需要设置20px,但它需要20px 从左侧而不是右侧。
li {background: url("../img/grey-arrow-next.png") no-repeat 20px center;
border-bottom: 1px solid #D4E8EB}
【问题讨论】:
-
想不到除了用js计算元素的宽度,减去“20+背景图片的宽度”,把左边那个像素的背景图片推到右边.不是很优雅……一点也不。
-
如果问题得到满意的回答,也许您应该选择其中一个答案。
标签: css