对基本的精灵内容有一点帮助
我是一名设计专业的学生,我的网页设计 I 课程即将结束。我正在开发我的最后一个网站,但我在精灵方面遇到了麻烦(我们在一堂课上讨论过这一点,我遵循了这一点,但现在我似乎无法弄清楚)。这是我第一次尝试在我为班级制作的网站中使用精灵。 不管怎样,我已经浏览了一些带有教程的网站,到目前为止我已经成功地让事情正常工作了……这是我的 html(用于导航):
[ul id="list"]
[li id="home"][a href="index.html"]home[/a][/li]
[li id="profile"][a href="profile.html"]profile[/a][/li]
[li id="work1"][a href="work-1.html"]1[/a][/li]
[/ul]
这是 CSS:
nav {
display:block;
position: absolute;
right:0;
top: 0;
z-index:2;
}
list {
background: url("../images/sprite-1.gif") no-repeat;
list-style: none;
width: 200px;
height:250px;
margin:0;
padding:0;
}
list li, list a {
display:block;
height:25px;
}
home a:hover {
display:block;
height:25px;
background-position:0px 75px;
}
抱歉代码的显示很粗糙;我不知道如何正确显示它。 我的设置方式有什么问题吗? 在这里,链接有效,我可以担心稍后隐藏文本链接。但是,我不知道如何为列表中的每个项目应用悬停图像。
谢谢你,
迈克尔
I'm a design student and I'm at the end of my Web design I course. I'm working on my final site, but I'm having trouble with sprites (something we went over in one class, which I followed, but now I can't seem to figure it out). It's the first time I'm trying to use sprites for a site I'm making for the class.
Anyway, I've looked over some sites with tutorials and I've managed to get things to work this far... here is my html (for the navigation):
[ul id="list"]
[li id="home"][a href="index.html"]home[/a][/li]
[li id="profile"][a href="profile.html"]profile[/a][/li]
[li id="work1"][a href="work-1.html"]1[/a][/li]
[/ul]
Here is the CSS:
nav {
display:block;
position: absolute;
right:0;
top: 0;
z-index:2;
}
list {
background: url("../images/sprite-1.gif") no-repeat;
list-style: none;
width: 200px;
height:250px;
margin:0;
padding:0;
}
list li, list a {
display:block;
height:25px;
}
home a:hover {
display:block;
height:25px;
background-position:0px 75px;
}
Sorry for the crude display of the codes; I can't figure out how to display this properly.
What is wrong with the way I have set things up?
Here, the links work, and I can worry about hiding the text links later. However, I can't figure out how to apply hover images for each item in my list.
Thank you,
Michael
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你会想要更多类似的东西:
在这种情况下 cssnav 是你的类 id
编辑:你可能还想将“css”标签添加到你的问题中
You're going to want something more like:
where in this case cssnav is your class id
edit: you might also want to add the "css" tag to your question