How to set font color size in html

下次还敢
Release: 2024-04-11 13:16:19
Original
1202 people have browsed it

Set font color and size through CSS styles in HTML. Font color is specified using the color property, which can be specified as a hex code, RGB value, or color name. Font size uses the font-size property, which can be specified in absolute or relative units, including pixels, ems, rem, and percentages.

How to set font color size in html

How to set font color and size in HTML

In HTML, you can use CSS styles to set font color and size.

Font color

Use thecolorproperty to set the font color. Colors can be specified as:

  • Hex codes starting with#, for example:#ff0000(red)
  • RGB Value, for example:rgb(255, 0, 0)(red)
  • Color name, for example:red,blue,green

Example:

这是红色的文本。

这是蓝色的文本。

这是绿色的文本。

Copy after login

font-size

Usefont-sizeProperty sets the font size. Font size can be specified in:

  • absolute units, for example:px(pixels),em(relative units),rem(Units relative to the root element)
  • Relative units, for example:%(Percentage relative to the parent element)

Example:

这是 20 像素大小的文本。

这是相对于父元素大小 1.5 倍的文本。

这是相对于根元素大小 1.2 倍的文本。

Copy after login

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

Related labels:
css
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!