为什么Chrome的“元素”检查器中会显示一些额外的<p></p>
标记?
以下是截图:
源代码是这样的;
<div class="hint">
<p><center class="hint-title">Tips</center></p>
</div>
感谢任何提示!
答案 0 :(得分:3)
由于您使用的是无效标记<center>
<center></center> is not in HTML5.
要在html代码中居中文字,请使用text-align:center;像这样
<p class="hint-title" style="text-align: center;">Tips</p>
使用css样式表中的类居中文本执行此操作
.hint-title { text-align: center; }