CSS的字体以及选择器的使用(笔记) | 您所在的位置:网站首页 › css规则加粗 › CSS的字体以及选择器的使用(笔记) |
选择器的分组 让多个选择器(元素)具有相同的样式,一般用于设置公共样式 h1,.box,span{ //分组 color: blue; } span{ background-color: crimson; }选择器的继承 子元素可以继承父元素的样式; .test{ font-size: 24px; } .test span{ font-weight: bold; font-size: 10px; //能继承父类的,也能重写,会对父类的属性进行覆盖; }优先级 内联样式>内部样式>外部样式; important :加在样式属性后面,权重为10000. 内联样式:如“style=”,权重值为1000 ID选择器:如#content的权重值为100; 类,伪类:如content、hover权重为10; 标签选择器:如div、p的权重为1; CSS字体 1、font-size:字号(px或者%)%是基于父元素的大小 2、font-famliy:字体 如果字母出现空格,就要用引号; 3、font-style:样式 (normal:正常 italic:斜体 oblique:倾斜的字体) 4、font-weight:加粗 (normal:正常400 bold:粗体700 bolder:更粗 lighter:更细){100-700} 5、line-height:行高 6、color:文字的颜色 7、text-decoration:文字的修饰 (none\normal\underline\overline\line-through) 8、text-align:文字的对齐方式 9、text-transform:字母的大小写 (none:无转化 capitalize:首字母换大写 uppercase:换大写 lowercase:转小写) 10、text-indent:文本缩进(number+px或者em)em 相对于父亲 font属性: font:font-style font-variant font-weight font-size /line-height font-famliy 注意: 属性值的位置 除了font-size和font-famliy之外,其他任何的属性都可以省略 font-variant:文本修饰 nomal/small-caps(让大写字母变的小一些) --- 学习于:b站求知讲堂 |
CopyRight 2018-2019 实验室设备网 版权所有 |