Fizzix Fizzix - 7 months ago 49
HTML Question

HTML aside tag vs div tag

What is the difference between the

div
tag and the new HTML5
aside
tag?


W3Schools has a very similar description for the two -



I have also seen many sites use the
aside
tag where a
div
tag would be perfectly fine.

Although, when I put them both into practise, they behave the same way, like so:

<aside>
<h4>This is a heading</h4>
<p>This is a very short paragraph.</p>
</aside>

<div>
<h4>This is a heading</h4>
<p>This is a very short paragraph.</p>
</div>


WORKING EXAMPLE

So my question is, what is the main difference between the two? When should one be used over the other?

Answer

Short answer:

<div> tag defines a general division or section in HTML.

<aside> tag represent same as but page content that are related to a aside element.

Difference

Behavior both are same but logically meaning different.

Comments