2

I'm developing a template using HTML5, and I want to align an aside on the left and a section on the right.

First question: Can I have only imgs inside a header tag?

Second question: Can I have only imgs inside an aside tag, or is the aside tag useless and I should switch to figure?

If this is all wrong, how should I organize this piece of code?

<header>
    <img id="logo" src="css/images/logo.png" alt="logotipo">
    <img id="slider" class="slider" src="css/images/slide_1.png" alt="logotipo">
</header>

<aside class="left float">           
    <img class="icon" src="css/images/icon.jpg" alt="licone">Name<br>   
    <img class="icon" src="css/images/icon.jpg" alt="licone">adress<br>   
    <img class="icon" src="css/images/icon.jpg" alt="licone">email<br>   
    <img class="icon" src="css/images/icon.jpg" alt="licone">phone<br> 
</aside>


<section class="right float">
    <article>
    </article>
</section>
unor
  • 92,415
  • 26
  • 211
  • 360
Johny tota
  • 55
  • 1
  • 9
  • 1
    Is like can i assign an `img` inside `div`, you say Yes. You can assign/wrap how ever you want to. Tags are just for presentation not for which element to wrap in which tag. – Rahil Wazir Feb 06 '14 at 19:38
  • 1
    You'll probably be interested in the W3C wiki pages for [the ` – ajp15243 Feb 06 '14 at 19:38
  • Are you asking if your example is valid (i.e., is it valid to have nothing else than `img` as children), or are you asking if it MUST not containg anything else than `img`? You accepted [user3237539’s answer](http://stackoverflow.com/a/21612359/1591669) and it seems he/she is answering it in the latter way. – unor Feb 08 '14 at 12:12

2 Answers2

3

First question: Can I have only have <img> elements inside <header> tags?

No. See the W3C specification section for <header>. It allows flow content, but doesn't allow <header>, <footer> or <main> descendants.

Second question: Can i have only img inside aside tag, or this aside tag is useless and i should switch to figure

No. See the W3C specification section for <aside>. It allows flow content, but doesn't allow <main> descendants.

If this is all wrong, how should I organize this piece of code?

It's not wrong, and you can organise it however you like - tags such as <aside> merely describe your intent as to what content is encapsulated inside of them.

If you have some content which you'd like to slightly separate from the main content on a page (while still being related content), use an <aside> etc.

Also, you may want to take a look at this - HTML5 best practices; section/header/aside/article tags.

Community
  • 1
  • 1
dsgriffin
  • 66,495
  • 17
  • 137
  • 137
  • 3
    Kind of nit picky over the term "documentation", but I'd consider the wiki just references, and the [W3C sections spec](http://www.w3.org/TR/html5/sections.html) the actual documentation for these elements. – ajp15243 Feb 06 '14 at 19:47
  • The header s ins't related to main content as they are just a logo and a slider and think it's appropriate to wrap into a div. The – Johny tota Feb 06 '14 at 20:08
  • 1
    @Johnytota Nope - – dsgriffin Feb 06 '14 at 20:21
-1

Can I have only imgs inside a header tag?

not only img tags, you can have other tags too inside header element;
please see: the list of HTML5 elemnts that can be nested inside header element

Can I have only imgs inside an aside tag?

not only img tags, you can have other tags too inside aside element;
please see: the list of HTML5 elements that can be nested inside aside element

Daniel
  • 379
  • 2
  • 6
  • 3
    Instead of posting duplicate answers, you should upvote the original one. This answer only adds noise and is a re-worded version of my answer! – dsgriffin Feb 08 '14 at 17:53