Home  >  Article  >  Web Front-end  >  How to change font size in div using css

How to change font size in div using css

WBOY
WBOYOriginal
2021-12-01 17:14:544220browse

In CSS, you can use the "font-size" attribute to change the font size in a div. The function of this attribute is to set the font size of the element. You only need to add "font-size: font size value" to the div element. ;" style is enough.

How to change font size in div using css

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

How to use css to change the font size in a div

You can change the font size in a div through the font-size attribute, font-size attribute For setting the size of the font.

The example is as follows:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title>
<style>
.div1{font-size:250%;}
.div2{font-size:100%;}
</style>
</head>
<body>
    <div class="div1">div中的字体大小设置</div>
    <div class="div2">div中的字体大小设置</div>
</body>
</html>

Output result:

How to change font size in div using css

(Learning video sharing: css video tutorial)

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