Home  >  Article  >  Web Front-end  >  Problem with p tag misalignment in html

Problem with p tag misalignment in html

黄舟
黄舟Original
2017-07-03 13:48:373441browse

<br>

Problem with p tag misalignment in html

The misalignment phenomenon as shown in the picture:

<html>
<head>
    <title>sda</title>
    </head>
    <body align=center>
    <p>故人西辞黄鹤楼    
    <p>烟花三月下扬州    
    <p>黄鹤一去不复返    
    <p>白云千载空悠悠    
    <br>
    <img  align=center src= "1.png" alt="Problem with p tag misalignment in html" >
    </body>
    </html>

Problem with p tag misalignment in html

has been corrected as shown<br>There are many solutions<br>But the principle they all adhere to is the issue of grammatical standards<br>1. Complete the p tag. The p tag can exist alone, but if it is written in a standardized way, try to complete it<br>2. The p tag Setting the text-align attribute to center can also solve <br>3. As discovered by 1, in fact, the <br> tag does not implement line wrapping, but It’s like giving a completion to the back tag of p. When the last p tag is replaced with

, it is obvious that there is an extra blank line between the picture and the text. This Can the blank line be understood as the function completion of the p tag or the function execution of the br tag?
<html>
<head>
    <title>sda</title>
    </head>
    <body align=center>
    <p>故人西辞黄鹤楼    
    <p>烟花三月下扬州    
    <p>黄鹤一去不复返    
    <p>白云千载空悠悠</p>
    <br>
    <img  align=center src= "1.png" alt="Problem with p tag misalignment in html" >
    </body>
    </html>

Another big guy said:

<br> If it is written at the beginning of the line, if the previous line is displayed to the end, it may be between the two lines Leave one extra line empty. It is better to write the <br> tag at the end of the line.

The above is the detailed content of Problem with p tag misalignment in html. 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