Home >Web Front-end >CSS Tutorial >How to change font size in div using css
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.
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:
(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!