How to set font size in css

青灯夜游
Release: 2021-01-28 09:16:07
Original
126761 people have browsed it

In CSS, you can set the font size through the font-size attribute, and the syntax format is "font-size: value;". The value of this attribute can be keywords such as "small", "large", "smaller", "larger", etc.; it can also be a value in px, em, rem, or % units.

The operating environment of this article: Acer S40-51, CSS3&&HTML5&&HBuilderX.3.0.5 version, Windows10 Home Chinese version

(Learning video sharing:css video tutorial)

In CSS, you can use the font-size attribute to adjust the font size; the font-size attribute is used to set the font size. If an element does not explicitly define the font-size attribute, it will automatically inherit the calculation result of the font-size attribute of the parent element.

Note that the font-size attribute actually sets the height of the character boxes in the font; the actual character glyph may be taller or shorter than these boxes (usually shorter).

Attribute values that can be set:

How to set font size in css

Example 1:

     

这是测试段落

这是测试段落

这是测试段落

这是测试段落

这是测试段落

Copy after login

Effect Picture:

How to set font size in css

##Example 2:

    

这是测试段落

这是测试段落

这是测试段落

Copy after login

Rendering:

How to set font size in css

Example 3:

    

这是测试段落

这是测试段落

这是测试段落

这是测试段落

这是测试段落

这是测试段落

这是测试段落

这是测试段落

Copy after login
Rendering:

How to set font size in css##For more programming-related knowledge, please visit:

Introduction to programming

! !

The above is the detailed content of How to set font size in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!