How to change text size in css

王林
Release: 2023-01-03 09:25:10
Original
3329 people have browsed it

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>
Copy after login

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!

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
Popular Tutorials
More>
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!