Home  >  Article  >  Web Front-end  >  How to customize font style in css

How to customize font style in css

王林
王林Original
2020-11-12 17:24:243506browse

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.

How to customize font style in css

##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(&#39;font/Fontin_Sans_I_45b.otf&#39;) 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn