具有流动宽度的多个图像的导航链接
我正在尝试创建一个导航菜单,其中的菜单项并不总是具有固定宽度。因此,我尝试使用一种技术,将 元素作为一个背景图像,然后将
元素作为背景图像。
具有不同的背景图像。我记得很久以前就看到过这个技巧,但凭记忆回忆却行不通。这是我的菜单标记:
<div id="nav">
<ul>
<li>
<a href="">Home<span></span></a>
</li>
</ul>
</div>
到目前为止我的 CSS:
#nav {
height: 35px;
width: 942px;
background: url('images/nav_bg.png');
border: 1px solid #74818c;
border-radius: 3px;
}
#nav ul li a {
display: inline-block;
background: url('images/nav_button_left_idle.png');
line-height: 32px;
}
#nav ul li a span {
display: inline-block;
background: url('images/nav_button_right_idle.png');
line-height: 32px;
width: 5px;
}
详细说明一下,这是我的 标签上使用的背景图像:
以及 元素上使用的 alt:
任何帮助将不胜感激,谢谢!
I'm trying to create a navigation menu with menu items that don't always have a fixed width. Because of this, I'm trying to use a technique where I have the <a>
element as one background image, and then a <span>
element within the <a>
having a different background image. I remember seeing this technique a long time ago and recalling it from memory just isn't working. Here's my menu markup:
<div id="nav">
<ul>
<li>
<a href="">Home<span></span></a>
</li>
</ul>
</div>
And my CSS this far:
#nav {
height: 35px;
width: 942px;
background: url('images/nav_bg.png');
border: 1px solid #74818c;
border-radius: 3px;
}
#nav ul li a {
display: inline-block;
background: url('images/nav_button_left_idle.png');
line-height: 32px;
}
#nav ul li a span {
display: inline-block;
background: url('images/nav_button_right_idle.png');
line-height: 32px;
width: 5px;
}
To elaborate a bit more, this is the background image used on my <a>
tags:
and the one used on the <span>
element:
Any help would be appreciated, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要设置跨度的高度和位置”
You need to set the height and position of your span"