1.首先,新建一个HTML文档,这里以Div css布局为例。
2.点击插入菜单下的“Div(D)”,弹出对话框。
3.点击“新建css规则”,定义一个选择器,“确定”完成。
4.设置大小及背景颜色,“确定”完成。
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。
很古老的话题了
id=100
class=10
tag(标签)=1
按照这个规律去计算,比如
#qietu div{}
100+1 = 101
.qietu .box{}
10+10=20
可以得出第一个的权重要比第二个要高。另外关于权重的扩展知识面,我推荐了解下BEM命名规则,这个观念很好,可以从侧面杜绝权重问题的产生,还有一个就是提高权重的方法 !important;
(2)使用方法:标签:before{content:"插入的内容";},可以修改插入内容的样式;
(3)排除一些不需要插入内容的元素:使用content属性的追加一个none属性值。使用方法:标签:before{content:none;}
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有