Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Right sidebar match content height?

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #185160
    jeverington
    Participant

    Hi,

    I’m trying to achieve the following layout for a website i’m working on.

    The layouts consists of a navbar, content, right sidebar (news) and footer. I want the sidebar to always be the height of the content and if the sidebar content is greater than the content height it should scroll.

    I’ve currently got a layout where the sidebar pushes down the footer, but without setting a manual height on the sidebar it will always be longer than the content.

    How could I best achieve this?

    Thanks

    Jamie

    #185163
    Paulie_D
    Member

    Perhaps you could show us a reduced example in a Codepen.io demo.

    #185164
    jeverington
    Participant

    Hi Paulie

    I’ve tried to represent what i’m after.

    This is what I have currently

    This is what I want, but without having to set the height

    Thanks

    Jamie

    #185165
    Paulie_D
    Member

    if the sidebar content is greater than the content height it should scroll.

    See….this is the hard part….equal heights have a lot of options (display:table-cell for instance & javascript) but you’re putting conditions like a scroll on means there has to be some way that the browser would ‘know’ that the sidebar is taller than the content and, AFAIK, CSS can’t do that.

    Whether you could do some clever wrapping in extra divs or something with positioning and restricting it that way…I dunno….but it doesn’t sound “friendly” to me.

    I’d have to think.

    #185166
    Paulie_D
    Member

    Hmm…ugly but it works.

    http://codepen.io/Paulie-D/pen/oDbdH

    Whether you can adapt it, I dunno.

    #185175
    jeverington
    Participant

    Thanks Paulie,

    Thanks for the sample. Not sure if that is workable for me. Will have to go down the JavaScript route I think. Cheers again!

    #185217
    dflores009
    Participant

    nm, just realized my solution was the same as Paulie_D.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.