Home >Web Front-end >CSS Tutorial >How to customize font style in css
How to customize font style in css: You can use the font attribute to customize the font style, such as [font-weight:normal;]. The font-weight attribute is used to set the thickness of text. If you want to set the text font size, you can use the font-size attribute.
##font shorthand property sets all font properties in one declaration.
(Learning video recommendation: css video tutorial)
Attributes:
font-family:设置文本的字体名称。 font-style:设置文本样式。 font-variant:设置文本是否大小写。 font-weight:设置文本的粗细。 font-stretch:设置文本是否横向的拉伸变形。 font-size:设置文本字体大小。 src:设置自定义字体的相对路径或者绝对路径,注意,此属性只能在@font-face规则里使用。
Example:
<style type="text/css"> *{margin:0px;padding:0px;} body{background:url("images/bj.jpg"); background-size:cover;} /*服务器字体引入自定义字体 -》 svg*/ @font-face{ /*定义我们自己的字体名称*/ font-family:WebFont; /*字体名称*/ src:url('font/Fontin_Sans_I_45b.otf') format("opentype");/*字体的地址 格式*/ font-weight:normal;/*italic oblique inherit */ } h1.font_my{font-family:WebFont; font-size:60px;} </style>
Related recommendations: CSS tutorial
The above is the detailed content of How to customize font style in css. For more information, please follow other related articles on the PHP Chinese website!