Home >Web Front-end >CSS Tutorial >css font controls multiple transformations of fonts
Tutorial recommendation: css video tutorial
CSS font properties define the font family, size, boldness, style (such as italics) and Deformed (such as small caps) font-family controls fonts. Since the fonts installed in each computer system are different, there are basically three fonts: Heibody, Songti, and Microsoft Yahei.
font-size
Control the font size. When we set the font size, we set its width and height. Generally, the default font size of the computer system is 16px, so the font size should not be lower than 16px. 1em=16px;
font-weight: bold;
/*The control font weight is generally 100-900. Commonly used lighter (fine body) normal (normal) bold bold*/
As for this font-style
, the default is normal, which is normal. If you set font-style: italic; italic, it is actually the same as this907fae80ddef53131f3292ee4f81644bd1c6776b927dc33c5d9114750b586338 The effect is almost the same; if the line-height used for the spacing between text is equal to the height, it will be vertically centered.
Usually the abbreviation of font font: font:style weight size/line-heigt font-family /*The two requirements that must appear are size and font-family*/
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>css常用样式font字体的多种变换</title> <style> div{ font-family: 'Microsoft YaHei';/*微软雅黑*/ /* font-family: 'Lucida Sans','Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; */ /*字体加上双引号或者单引号,当有多个字体的时候,中间逗号分开*/ color:#f90; font-size: 24px;/*控制字体大小*/ font-weight: bold; /*控制字重 常用lighter(细体) normal(正常)bold加粗 */ font-style: italic;/*等同于em*/ line-height: 30px; } /*font字体的简写:font:style weight size/line-heigt font-family*/ /*要求必须出现的2个是 size font-family*/ p{ font: 24px/1.5em 'Lucida Sans','Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; letter-spacing: 1px;/*英文字母间距*/ word-spacing: 10px;/*英文单词间距*/ } P::first-letter{ text-transform: capitalize; }/*第一个字母::first-letter*/ p::first-line{ color:red; }/*第一行::first-line*/ </style> </head> <body> <div>技术为王世界,欲问青天山顶景色是否独好技术为王世界, 欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界, 欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好技术为王世界, 欲问青天山顶景色是否独好技术为王世界, 欲问青天山顶景色是否独好技术为王世界,欲问青天山顶景色是否独好 </div> <p>Technology is king world, I want to ask if the scenery on the top of Qingtian Mountain is the king of technology, I want to ask whether the scenery of Qingtian Peak is the king of technology. If the technology is the king of the world, I would like to ask whether the scenery on the top of Qingtian Mountain is the king of the world. Is the scenery good?</p> </body> </html>
About style inheritance Question/*Styles related to text will be inherited*/The code is shown below:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>index</title> <style> p{ font-size: 20px; font-family: 微软雅黑; color:#f00; font-weight:bold; font-style:italic; word-spacing:15px; } </style> </head> <body> <div> <p><span>linux php linux</span></p> <p><span>linux linux php linux</span></p> <p><span>linux linux php linux</span></p> <p><span>linux linux php linux</span></p> </div> </body> </html>
For more programming-related knowledge, please visit: Programming Teaching! !
The above is the detailed content of css font controls multiple transformations of fonts. For more information, please follow other related articles on the PHP Chinese website!