我可以直接在< div> ...</div>中输入文字吗?还是我需要将其包装在< p> ...</p>中第一的? [英] Can I put text directly in <div>...</div>? Or do I need to wrap it in <p>...</p> first?
本文介绍了我可以直接在< div> ...</div>中输入文字吗?还是我需要将其包装在< p> ...</p>中第一的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这个问题听起来很愚蠢,但是关于我的问题的实践是什么.我应该一直这样做吗?
This question sounds pretty stupid but what is the practice regarding my question. Should I always do this:
<div>
Text goes here. Lots of text.
</div>
还是我应该始终将文本包裹在< p>
标记中?
Or should I always wrap text in a <p>
tag?
<div>
<p>Text goes here. Lots of text.</p>
</div>
请告知.
推荐答案
是的,您可以将其直接放在div中.您应该执行在层次上正确且在语义上适合于您尝试执行的所有操作.这可能意味着您需要一个p标签,也可能不需要.
Yes, you can put it directly in the div. You should do whatever is hierarchically correct and semantically appropriate for whatever you are trying to do. That may mean you need a p tag, or it may not.
这篇关于我可以直接在< div> ...</div>中输入文字吗?还是我需要将其包装在< p> ...</p>中第一的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文