How to set font color and size in html

下次还敢
Release: 2024-04-11 08:41:06
Original
683 people have browsed it

To set HTML font color and size, use the following methods: Use the color attribute to set the color, which can be a hex code, RGB value, or color name. Use the font-size property to set the size, which can be absolute (pixels or inches) or relative (em or rem). To set both color and size, use the style attribute and include the color and font-size attributes.

How to set font color and size in html

How to set HTML font color and size

Font color

To set the HTML font color, use thecolorattribute. This property is followed by a color value, which can be a hexadecimal code, an RGB value, or a predefined color name. For example:

红色文本

绿色文本

蓝色文本

Copy after login

Font size

To set the HTML font size, use thefont-sizeattribute. This attribute is followed by a size value, which can be absolute (such as pixels or inches) or relative (such as em or rem). For example:

16 像素文本

1.2 倍默认字体大小的文本

1.5 倍根字体大小的文本

Copy after login

Set both color and size in one element

To set both color and size in one element, usestyleproperties, and include thecolorandfont-sizeproperties. For example:

蓝色 16 像素文本

Copy after login

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

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!