tags:

views:

29

answers:

2

i noticed that in the following example, note the classes, i am using 960gs in case the classes css interfered

html

<section id="main" class="container_12">
  <div class="grid_12">
    <article>
    ...

css

header, footer, section, article, nav, aside { display: block; }
#main { background: #fff; }

i noticed that #main has a height of 0 in firebug. also if i do a

#main .grid_12 { background: #fff; } 

it works

i noticed that if i use a div instead of section the css works

UPDATE

turns out that its because of the div.grid_12 or rather div.grid_x that causes the problem, if i remove that <div> it will work even if i am using <section>

<section id="main" class="container_12">
  <div class="grid_10"> <!-- <<< this div -->
A: 

From the spec:

The section element is not a generic container element. When an element is needed for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead. A general rule is that the section element is appropriate only if the element's contents would be listed explicitly in the document's outline.

Andy E
i know but i am taking the main content area as a part of the app? does that mean that i shld not attach any styles to the section element? or all HTML5 elements? even then, its height shld not be 0?
jiewmeng
@jiewmeng: it seems like it's implemented in a way that doesn't affect the flow of the document, so its height is 0 and you cannot see any styles applied to it. The section element should be used more for its semantic meaning than as a container. You can either put a container `<div>` inside and apply the styles to that or swap the `<section>` out for a `<div>`.
Andy E
it seems even with a `<div>` it does not work ... hmm ... height is 0 wierd
jiewmeng
see update: turns out that its because of the `div.grid_12` or rather `div.grid_x` that causes the problem, if i remove that `<div>` it will work even if i am using `<section>`
jiewmeng
@jiewmeng: good to see that you figured it out.
Andy E
A: 

i found the answer, grid_x has float: left i need to clear it

jiewmeng