发布于2022-05-23 22:49 阅读(286) 评论(0) 点赞(7) 收藏(1)
我找不到任何可以完全回答我的问题的问题;至少在我看来。所以,如果它已经得到回答,我很抱歉。
我有一个无序列表,用作导航栏。我创建了一个精灵来为悬停状态提供单独的“图像”。这一切都很好,我把它放在页面中间,就像我想要的那样。
当我向样式表添加背景颜色时,问题就来了。导航菜单由于某种原因消失了,我不太明白;也许是因为我使用的 CSS 样式表重置编码?
这是一个例子......这是html......
<header class="centered">
<ul id="navbar">
<li class="home"><a href="#" title="home">home</a></li>
<li class="gallery"><a href="#" title="gallery">gallery</a></li>
<li class="contact"><a href="#" title="contact">contact</a></li>
</ul>
</header> <!-- end of header -->
这是css...
#navbar{
display: block;
width: 481px;
height: 55.5px;
background: url(../images/navbar2.png) left top no-repeat;
}
#navbar li{
display: block;
float: left;
}
#navbar li a{
display: block;
height:55.5px;
text-indent:-9999px;
}
#navbar li a:hover,
#navbar li a.on{
background-image: url(../images/navbar2.png);
}
#navbar li.home a{
width:142px;
background-position:-0px -55.5px;
}
#navbar li.gallery a{
width:166px;
background-position:-142px -55.5px;
}
#navbar li.contact a{
width:173px;
background-position:-308px -55.5px;
}
现在,我在样式表开头的“CSS 样式表重置”代码中应用了背景颜色……这是其中的一个片段。
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background: transparent;
background-color: #000000;
}
作者:黑洞官方问答小能手
链接:http://www.qianduanheidong.com/blog/article/360642/57ac5e1eb9cb8fc486c9/
来源:前端黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 前端黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-3
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!