<br></p>
</p>
The misalignment phenomenon as shown in the picture: </p>
<html> <head> <title>sda</title> </head> <body align=center> <p>故人西辞黄鹤楼 <p>烟花三月下扬州 <p>黄鹤一去不复返 <p>白云千载空悠悠 <br> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/194/1c4fb9ee594029281cc632da83a62d90-1.png" class="lazy" align=center src= "1.png" alt="Problem with p tag misalignment in html" > </body> </html>
</p>
has been corrected as shown
There are many solutions
But the principle they all adhere to is the issue of grammatical standards
1. Complete the p tag. The p tag can exist alone, but if it is written in a standardized way, try to complete it
2. The p tag Setting the text-align attribute to center can also solve
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 </p>
, 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? </p>
<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: </p>
<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. </p>
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!