Home  >  Article  >  Web Front-end  >  How to change text size in css

How to change text size in css

王林
王林Original
2021-02-24 16:38:283384browse

How to change the text size in css: You can use the font-size attribute to change the text size, such as [h1{font-size:250%;}], which means setting the h1 element based on the parent element A percentage value.

How to change text size in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

Introduction to text attributes:

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

Attribute value:

How to change text size in css

Demo code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文网</title>
<style>
h1 {font-size:250%;}
h2 {font-size:200%;}
p {font-size:100%;}
</style>
</head>

<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<p>This is a paragraph.</p>
</body>

</html>

Run result:

How to change text size in css

Recommended learning: CSS tutorial

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