为什么.top-content li的样式无法起作用,但是把.top-content去掉后又可以,但是只用li又会跟后面导航栏里的li有冲突?

来源:3-3 企业网站制作之页面头部制作(二)

慕妹0475077

2018-11-12 22:11

有.top_contentde 的时候,css没有效果:

https://img3.mukewang.com/5be989db0001a83218950254.jpg

*{
    margin:0;
    padding:0;
    font-size:12px;
}
body{
    background-color: #f5f5f5;
}
.top{
    width:100%;
    height:27px;
    background:url(../img/top_bg.jpg) repeat-x;
}
.top_content{
    width:1000px;
    margin:0 auto;
}
.top_content li{
    list-style-image: url(../img/li_bg.png);
    float:right;
    width:70px;
    line-height: 27px;
}
.top_content a:link,.top_content a:visited{
    color:#fff;
    text-decoration: none;
}
.top_content a:hover,.top_content a:active{
    color:#900;
    text-decoration: none;
}

没有.top_contentde 的时候,css有效果:

https://img2.mukewang.com/5be989b90001d3e119200196.jpg

*{
    margin:0;
    padding:0;
    font-size:12px;
}
body{
    background-color: #f5f5f5;
}
.top{
    width:100%;
    height:27px;
    background:url(../img/top_bg.jpg) repeat-x;
}
.top_content{
    width:1000px;
    margin:0 auto;
}
li {
    list-style-image: url(../img/li_bg.png);
    float:right;
    width:70px;
    line-height: 27px;
}
a:link,a:visited{
    color:#fff;
    text-decoration: none;
}
a:hover,a:active{
    color:#900;
    text-decoration: none;
}


写回答 关注

1回答

  • iFlowers
    2019-01-13 20:31:10

    是否是你的类名错误,我看你问题介绍上用的是.top-content li,但是样式中用的又是.top_content li。

企业网站综合布局实战

本课程重点介绍HTML/CSS实现常见企业网站布局的方法

157081 学习 · 2157 问题

查看课程

相似问题