我可以直接在< 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.