在元素中显示背景图像时的CSS问题

发布于 2024-08-06 03:18:54 字数 237 浏览 4 评论 0原文

我遇到了一个问题,假设我想显示链接的背景图像,

                  |   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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伪装你 2024-08-13 03:18:54

以下代码可以满足您的需要:

<style>
    .biglink {
        margin: 0 13px 0 13px;
        background: url('background.png') no-repeat center center;
    }
</style>

The following code does what you need:

<style>
    .biglink {
        margin: 0 13px 0 13px;
        background: url('background.png') no-repeat center center;
    }
</style>
羁客 2024-08-13 03:18:54

我相信背景遵循 paddingmargin css 样式,因此您可以设置 margin-left: 13px;margin-right: 13px;

I believe background obeys the padding and margin css styles, so you could set margin-left: 13px; and margin-right: 13px;.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文