為什么.top-content li的樣式無法起作用,但是把.top-content去掉后又可以,但是只用li又會跟后面導航欄里的li有沖突?
有.top_contentde 的時候,css沒有效果:
*{ ????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有效果:
*{ ????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; }
2019-01-13
是否是你的類名錯誤,我看你問題介紹上用的是.top-content li,但是樣式中用的又是.top_content li。