css中 如何把新闻这一行变成绿色? 为什么添加active {background-color:#afc; }之后

html-css012

css中 如何把新闻这一行变成绿色? 为什么添加active {background-color:#afc; }之后,第1张

方法一、把.active加到li标签

li.active{background-color:#afc}

方法二、把a标签设置属性display

a{display:blockwidth:100%}

News5 li{no-repeat top leftpadding-left:15pxpadding-bottom:-10pxmargin-bottom:0px}

调整no-repeat top left这个,应该写成no-repeat left top把其中的top改为数值 调整数值大小到背景为居中位置就可以了 如3px 5px等等