Home  >  Article  >  Web Front-end  >  How to use css font-size attribute

How to use css font-size attribute

青灯夜游
青灯夜游Original
2019-05-30 11:50:063704browse

css The font-size attribute is used to set the font size of an element. This property 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).

How to use css font-size attribute

How to use the css font-size attribute?

The font-size property sets the size of the font.

Attribute values ​​that can be set:

Value Description

xx-small

x-small

small

medium

large

x-large

xx-large

Set the font size to different sizes, from xx-small to xx-large.

Default value: medium.

smaller Set font-size to a smaller size than the parent element.
larger Set font-size to a larger size than the parent element.
length Set font-size to a fixed value.
% Set font-size to a percentage value based on the parent element.

#Description: This attribute sets the font size of the element. Note that this 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). The font corresponding to each keyword must be taller than the font corresponding to the smallest keyword and smaller than the font corresponding to the next largest keyword.

Note: All major browsers support the font-size attribute.

css font-size attribute example

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<style type="text/css">
h1 {font-size: 300%}
h2 {font-size: 200%}
p {font-size: 100%}
</style>
</head>
<body>
<h1>php中文网</h1>
<h2>php视频教程</h2>
<p>php程序员词典</p>
</body>
</html>

Rendering:

How to use css font-size attribute

The above is the detailed content of How to use css font-size attribute. 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