循环遍历数据下,怎么增加背景图标?
.findbox ul li:nth-child(1) {}.findbox ul li是你的样式名称,:nth-child(1)是选择器的属性,那个数字是指第几行。
通过这个可以给循环遍历的数据增加背景图标,当然了这其中还要加上其他属性。
这里假设图标放在左边来展示。
background-size: 20px; //控制图标大小
padding-left: 25px;//文本与图标的距离
background-position: 15px center;// 图标左边外边距
页:
[1]