Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 <aside> tag

Tags:

html

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.

like image 337
lotuslove Avatar asked Dec 11 '22 22:12

lotuslove


2 Answers

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.

like image 92
Matthew Avatar answered Dec 26 '22 19:12

Matthew


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.

like image 35
James South Avatar answered Dec 26 '22 20:12

James South