@ css怎么增加边框没有间隙?
css增加边框没有间隙的方式如下
方法一:通用兄弟选择器( ~ )
Document
ul {margin: 0; padding: 0;}
li { list-style: none; height: 50px; line-height: 50px;}
li~li {border-top: 1px solid #000;}
1
2
3
4
5
6
li~li {…} 中的 ~ 符号称为通用兄弟选择器,匹配P元素之后的P元素,所以第一个P元素不会匹配到。
方法二:伪类选择器( :first-of-type / :last-of-type )
Document
ul {margin: 0; padding: 0;}
li { border-top: 1px solid #000; list-style: none; height: 50px; line-height: 50px;}
li:first-of-type {border-top: none;}
1
2
3
4
5
6
首先将所有 li 设置 border-top,然后用 :first-of-type 查找到第一个 li ,取消border-top。
@ css选择器项目符号图像是什么?
css样式属性list-style-image :设定列表项目符号的自定义图像。其值是一个引用图像的URL路径。
url ( url ) —— 使用绝对或相对 url 地址指定图像。
@ css层次选择器怎么用?
css层次选择器具体用法如下:
采用后代选择器 :从上面可以看出所有的标签都是body的后代,那么大家使用后代选择器,就可以将body的后代(所有标签)改变样式: 后代选择器是用祖先加上空格再加上后代标签类型进行声明的。
以上资料供参考。