1

I'm struggling with a sidebar height.

My container is now showing the correct height (that of the content inside), but my sidebar that should be using 100% of that height is still not appearing.

I've implemented one of the suggestions below (http://www.quirksmode.org/css/clearing.html) but the sidebar's still not appearing.

I'm sure this is a simple one for you pros, any tips appreciated!

Thanks,

Tom

Here's my code: http://jsfiddle.net/tomperkins/wy52B/

Tom Perkins
  • 499
  • 3
  • 7
  • 16

2 Answers2

1

Check out this way of clearing floats, it's a lot cleaner and easier to use.

brad
  • 31,987
  • 28
  • 102
  • 155
  • Thanks, a neat solution. Still not making the sidebar appear though. Any ideas? – Tom Perkins Dec 30 '10 at 17:49
  • having a hard time parsing through all the code in jsfiddle, maybe if you could do a simple example with main content and sidebar, omit any other unnecessary tags and it's easier to debug – brad Dec 31 '10 at 03:31
0

Don't use clearfix

It's not necessary in most situations, and it's definitely not semantic.

The simple solution for most cases: float the parent.

HTML:

<div class="parent">
  <div class="child">
  </div>
  <div class="child">
  </div>
</div>

CSS:

.parent
{
  float: left;
  width: 100%; /*or whatever you want it to be*/
}

.child
{
  float: left;
  width: 50%;
}
Community
  • 1
  • 1
zzzzBov
  • 174,988
  • 54
  • 320
  • 367