When using the <aside>
tag in HTML 5, do we need to add float:right
(or left
) attribute for it? Because most of the time, it's used as sidebar, I think.
It's basic question, but I just want to figure out the right way to use it.
You don't need to add anything. HTML is a language to define the structure of a document. You should pick HTML tags based on their semantic meaning, not how they are to be displayed, which is what CSS is for.
You would use an <aside>
tag where the content contained within is auxiliary to the main content of the page.
To further elaborate my explanation, <div>
, <header>
, <footer>
, <main>
, <article>
, <nav>
, <aside>
, and <section>
all render identically, but they have vastly different semantic meaning.
The aside
element is not called so because of positioning it gets it's name for being designed to contain secondary content. It can be styled any way you like but is supposed to be placed semantically in your DOM based on its content.
Have a read of the excellent article here on Html5Doctor for a further explanation.
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