css选择器


css选择器
1.标签选择器p{} span{} h1{}
2.class类名/类别选择器
3.id选择器
id名称唯一,优先级比class和标签要高
4.后代
p span{}  p .text{}
5.子代
p>span>b{} 逐级写不能跳级
6.通用选择器
*{} 所有标签都应用
7.群组选择器
body,ul,ol,h1{}
8.伪类选择器
:hover{}鼠标滑过
:active{}鼠标点击时
:visited{}鼠标访问过后

9.交叉选择器
p.text{}   a.first{}   div#box{}

10.兄弟
11.属性

css继承属性
1.color
2.font-size
3.font-weight
4.font-family
5.font-style
6.text-align

css样式
1.字体样式
-①字体类型font-family
font-family: “微软雅黑”;
-②字体大小 font-size
font-size:12px;
网页字体设置都是偶数字体,12,14,16,18等,网页最小字体12px,px是像素
-③字体粗细font-weight
font-weight:bold/bolder/100-900
-④字体斜体font-style
font-style:italic/oblique;

2.text系列
①文字位置text-align
text-align:left 文字居左
text-align:center 文字居中
text-align:right 文字居右
在父级设置text-align:center,可以使盒子内图片和文字居中
3.首行缩进text-indent
文字首行缩进text-indent
4.文字样式text-decoration
text-decoration:underline下划线
text-decoration:line-through删除线
text-decoration:none清除下划线

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279523.html

(0)
上一篇 2022年8月8日
下一篇 2022年8月8日

相关推荐

发表回复

登录后才能评论