lotuslove
lotuslove

Reputation: 51

html5 <aside> tag

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.

Upvotes: 4

Views: 4486

Answers (2)

Matthew
Matthew

Reputation: 25743

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.

Upvotes: 10

James South
James South

Reputation: 10635

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.

Upvotes: 3

Related Questions