在元素中显示背景图像时的CSS问题
我遇到了一个问题,假设我想显示链接的背景图像,
| words |
条形意味着链接的开始/结束,它实际上并不存在
,我希望背景图像水平显示,但不是从条形开始,并在酒吧结束,
我希望它开始距左栏 13px,距右栏 13px?
我知道css中有一个背景位置,但是我可以要求背景位置为我指定13px吗???
i got a issue, let say i want to display a background image for a link
| words |
the bars mean the start/end of the link, it doesn`t actually exist
and i want the background image display horizontally, but not start from the bar, and end at the bar,
i want it start 13px away from the left bar and 13px away from the right bar??
i know there is a background-position in css, but can i ask the background-position to specify the 13px for me???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下代码可以满足您的需要:
The following code does what you need:
我相信背景遵循
padding
和margin
css 样式,因此您可以设置margin-left: 13px;
和margin-right: 13px;
。I believe background obeys the
padding
andmargin
css styles, so you could setmargin-left: 13px;
andmargin-right: 13px;
.