css样式的问题

<ul>
    <li style="background: url('images/toDoEmpty.svg')no-repeat;width: 17px;height: 17px"></li>
    <li style="background: url('images/toDoEmpty.svg')no-repeat;width: 17px;height: 17px"></li>
    <li style="background: url('images/toDoEmpty.svg')no-repeat;width: 17px;height: 17px"></li>
</ul>

写了行内样式,然后在写

<style>
   li:nth-child(3):hover{
       width: 17px;
       height: 17px;
       background: url("images/toDoEmptyHover.svg")no-repeat;
   }
</style>

为什么会没有效果

薏苡x
浏览 2406回答 6
6回答

菜鸟教程

内联样式权重最高,当然是先用内联样式了。内联>id选择器>class选择器 内联样式写一个人class即可。

名分开就是姓名

css优先行内样式,背景图片的地址有问题所以没效果,那个svg地址前面加个/,svg文件必须xml格式
打开App,查看更多内容
随时随地看视频慕课网APP