Most of us have seen before something like this:
<div class="rights">All rights reserved!</div>
I just wanted to know, is this a right job? or althogh it will render in browser, it is better to use <p>
tag for example?
I am asking this to know if it has any Google(SEO), Page load time, Compatibality, HTML Validity, ... issues/downsides.
Yes, it is ok to use a <div> element without <p> .
Any sort of content can be put inside the <div> tag! Note: By default, browsers always place a line break before and after the <div> element.
Div tag has both open(<div>) and closing (</div>) tag and it is mandatory to close the tag. The Div is the most usable tag in web development because it helps us to separate out data in the web page and we can create a particular section for particular data or function in the web pages.
So, in web design, a semantic element is an element that has intrinsic meaning, and conveys that meaning to both the browser and the developer. For example, <div> and <span> are non-semantic elements. They tell us nothing about their contents.
Well first of all, most browsers will automatically add space (margin) around the <p>
tag.
There is no real performance issue wether you use or not the <p>
tag. Also, the html won't be invalid.
The main reason of using this tag would be to indicate to the browser that you are defining a block element.
Search engine optimization won't be affected by this.
Edit : In your example, you would be better using the <p>
tag since the <div>
is also a block element and has nothing else then text in it so it would be more specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With