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 and size in HTML
In HTML, you can use CSS styles to set font color and size.
Font color
Use thecolor
property to set the font color. Colors can be specified as:
#, for example:#ff0000
(red)rgb(255, 0, 0)
(red)red
,blue
,green
Example:
这是红色的文本。
这是蓝色的文本。
这是绿色的文本。
font-size
Usefont-size
Property sets the font size. Font size can be specified in:
px
(pixels),em
(relative units),rem
(Units relative to the root element)%
(Percentage relative to the parent element)Example:
这是 20 像素大小的文本。
这是相对于父元素大小 1.5 倍的文本。
这是相对于根元素大小 1.2 倍的文本。
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!