0

I have a layout wherein the sidebar is fixed and the main contents container is fluid.

        <div id="contents" class="wrapper group">
            <aside id="sidebar">
                <!-- sidebar stuff here -->
            </aside>
            <section id="main-contents">
                <!-- content here -->
            </section>
        </div>

http://jsfiddle.net/QzsL5/2/

When I apply the class "group" to the ul of feeds, the ul has extra pixels added to its height, it doesn't just wrap the li inside it. But when I delete the sidebar, this extra height isn't shown. I noticed that the bottom of the ul is aligned with the bottom of the sidebar.

I don't know why it behaves this way. Help on this would be appreciated.

Thank you :)

dork
  • 4,396
  • 2
  • 28
  • 56

1 Answers1

0

I think what you might be missing is a 'clearfix' solution within your css.

Updated Fiddle: http://jsfiddle.net/QzsL5/4/

.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.clearfix {
    display: inline-block;
}

html[xmlns] .clearfix {
    display: block;
}

* html .clearfix {
    height: 1%;
}

After implementing the above within your css, add the following class name 'clearfix' to your UL.

Starboy
  • 1,635
  • 3
  • 19
  • 27
  • Hey, @Starboy, that worked! Thanks. but would you happen to know why? because the "clearfix" I used is the latest version according to http://css-tricks.com/snippets/css/clear-fix/ I just replaced the .clearfix with .group by the way – dork Jun 14 '13 at 08:54
  • @omgdork Did you have it incorporated into your fiddle you previous posted? – Starboy Jun 14 '13 at 09:04
  • Also, I noticed that there's still some space between the
      and the

      . Why is that? (not talking about the margin, you can remove the margin and still see some 2-3pixels of space between them)

    – dork Jun 14 '13 at 09:08
  • nope. I just used .group:after { content: ""; display: table; clear: both; } the update from August 2012. – dork Jun 14 '13 at 09:09
  • Not a problem, for the clearfix the one you posted from css tricks WILL WORK. The reason I think you ran into some troubles is you might have added other attributes. Best case in the future just add the class 'clearfix' onto items. – Starboy Jun 14 '13 at 09:13
  • Whoops sorry. There. Wait, which attributes might that be? – dork Jun 14 '13 at 09:43
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/31756/discussion-between-omgdork-and-starboy) – dork Jun 14 '13 at 09:54