Home > Article > Web Front-end > Can the height of p tag be set in css?
In css, you can set the height of the p tag by using the height attribute. The function of the height attribute is to set the height of the element. You only need to add the "height: height value;" style to the p tag element.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Can the p tag in css set the height?
Can the p tag in css set the height.
The p tag in css can use the height attribute to set the height. The function of this attribute is to set the height of the element.
Let’s take a look at how to set it up through an example. The example is as follows:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> p{ width:200px; height:100px; border:2px solid red; } </style> </head> <body> 123123123 <p>这是一个p标签。</p> 123123132 </body> </html>
As an example for everyone to understand, a border style is added to the p tag. If the height style of the p tag is not set, The output result is as follows;
After setting the height attribute through the above code, the output result is as follows:
( Learning video sharing: css video tutorial)
The above is the detailed content of Can the height of p tag be set in css?. For more information, please follow other related articles on the PHP Chinese website!