简体   繁体   English

为什么还有一些额外的` <p></p> `标签显示在Chrome的Elements检查器中?

[英]Why there is some extra `<p></p>` tags showing in the Elements inspector of Chrome?

Why there is some extra <p></p> tags showing in the Elements inspector of Chrome? 为什么Chrome的Elements检查器中会显示一些额外的<p></p>标记?

Here is a screenshot: 这是一个截图:

在此输入图像描述

Source code is like this; 源代码是这样的;

<div class="hint">
  <p><center class="hint-title">Tips</center></p>
</div>

Thanks for any kind of tips! 感谢您的任何提示!

It's adding extra tags because you are using an invalid tag <center> 它正在添加额外的标签,因为您使用的是无效标签<center>

<center></center> is not in HTML5.

To center text in the html code, use text-align: center; 要使html代码中的文本居中,请使用text-align:center; like this 像这样

 <p class="hint-title" style="text-align: center;">Tips</p>

To center text with classes in your css stylesheet do this 要使用css样式表中的类居中文本,请执行此操作

.hint-title { text-align: center; }

http://www.w3schools.com/tags/tag_center.asp http://www.w3schools.com/tags/tag_center.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM