Can the height of p tag be set in css?

WBOY
Release: 2021-11-26 14:54:59
Original
4429 people have browsed it

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.

Can the height of p tag be set in css?

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

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;

Can the height of p tag be set in css?

After setting the height attribute through the above code, the output result is as follows:

Can the height of p tag be set in css?

( 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!

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!