border:1px dashed #F00 这个就是设置边框样式宽度为1px,虚线,虚线为红色,最主要的是关键字dashed
css有没有bordertop?
有的。
在css中,border-top属性是一个简写属性,是用来将元素上边框的所有的属性定义到一个声明中,当大家要单独设置元素上边框的显示效果的时候,就可使用css中的border-top属性来实现。
border-top属性所定义的上边框属性:border-top-width(上边框宽度)、border-top-style(上边框样式)、border-top-color(上边框颜色)。
css八大类?
在dw中,css属性有八大类:
1、Type类型;2、Background背景;3、Block块;4、Box盒子;5、Border边框;6、List列表;7、Positioning定位;8、Extensions扩展。
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。