Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I put text directly in <div>...</div>? Or do I need to wrap it in <p>...</p> first?

Tags:

html

text

tags

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>

Or should I always wrap text in a <p> tag?

<div>
 <p>Text goes here. Lots of text.</p>
</div>

Please advise.

like image 580
bodacydo Avatar asked Oct 19 '22 01:10

bodacydo


1 Answers

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.

like image 164
elixenide Avatar answered Oct 30 '22 02:10

elixenide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!