Font text"; 2. Use the style attribute in the label element containing the font text and add "font- size:value;" style is enough."/> Font text"; 2. Use the style attribute in the label element containing the font text and add "font- size:value;" style is enough.">

Home  >  Article  >  Web Front-end  >  How to change font size in html

How to change font size in html

青灯夜游
青灯夜游Original
2021-04-30 17:27:0827908browse

How to modify the font size of html: 1. Use the font tag with the syntax format "font text"; 2. Use the style attribute in the tag element containing the font text and add "font- size:value;" style is enough.

How to change font size in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Method 1: Use the font tag

to specify the font, font size, and font color of the text.

Syntax for setting font color:

<font size="数值">字体文本</font>

The range of the size attribute value: a number from 1 to 7. The browser default is 3.

Example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<div>测试文本</div>
		<div><font size="5">测试文本</font></div>
	</body>
</html>

Rendering:

How to change font size in html

##Method 2: Use “font-size: value; "Style

Example:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<div>测试文本</div>
		<div style="font-size: 30px;">测试文本</div>
	</body>
</html>

Rendering:


How to change font size in html

css font-size attribute is used to set the font size.

ValueDescriptionSet the font size to different sizes, from xx-small to xx-large. smallerlargerlength%inherit(Learning video sharing:
##xx-small
  • x-small
  • small
  • medium
  • large
  • x-large
  • xx-large

Default value: medium.

Set font-size to a smaller size than the parent element.
Set font-size to a larger size than the parent element.
Set font-size to a fixed value.
Set font-size to a percentage value based on the parent element.
Specifies that the font size should be inherited from the parent element.
css video tutorial

)

The above is the detailed content of How to change font size in html. 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