Forums

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

Home Forums CSS Responsively word wrapping content around a sidebar

  • This topic is empty.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #43265
    solarized
    Member

    Hi all,

    Is it possible to responsively word wrap content around a side bar?

    I’ve tried to create a demo here: http://codepen.io/jcskyrock/pen/xiFLH

    Would like it if the the content text wrapped underneath the sidebar. Whilst maintaining the nice responsive TB functionality of moving the sidebar underneath the content on small screens.

    #127606
    wolfcry911
    Participant

    Is the height of the sidebar static or dynamic? Solution is simple if it’s static, but I’m guessing it’s dynamic…

    #127612
    solarized
    Member

    Yup, ‘fraid so. Dynamic sidebar for sure.

    #127614
    wolfcry911
    Participant

    Here’s a solution with jquery and media queries (could be done with just jquery).
    http://codepen.io/wolfcry911/full/CLjIs

    #127616
    solarized
    Member

    Beautiful!

    #127619
    wolfcry911
    Participant

    I should note that that is but one way. You could also position: absolute the sidebar and use jquery to calculate the needed -bottom length.

    edit// I just realized this can be done without jquery using top: 100%

    http://codepen.io/wolfcry911/full/CLjIs

    #127621
    Merri
    Participant

    I’ll throw a challenge: what if I wanted the sidebar to be after the content in HTML? (I’m working on it myself right now, but my JavaScript is on the rusty side so it’s slow progress to make it solid enough. Could account for dynamic element size changes…)

    **Edit!**
    http://codepen.io/Merri/full/yGKCJ

    #127631
    solarized
    Member

    Oh man, some great solutions. Thanks!

    #127648
    solarized
    Member

    @wollfcry911, do you have an example of the position: absolute idea without jQuery?

    #127663
    wolfcry911
    Participant

    Sorry about that – my second link above was meant to be this:

    http://codepen.io/wolfcry911/full/cCrDs

    #127673
    Merri
    Participant

    The downside is that you can’t have any other element neatly under the container as the absolutely positioned element would go on top of it. So you’d be limited to defined height to make sure whatever comes after the container would be visually accessible.

    #127676
    solarized
    Member

    Thanks, wolfcry911!

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