Forums

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

Home Forums CSS [Solved] Position fixed width of parent

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

    Hi guys. I’m having a problem with position fixed.
    I created this fiddle in order to explain the problem.
    http://jsfiddle.net/4bGqF/870/

    I need that the div styled with position fixed stays 100% width of it’s parent but don’t goes on top of the scrollbar.

    Is there a way to do this?

    Thanks in advance

    #167313
    Paulie_D
    Member

    It’s not clear what you are trying to do but I don’t think position:fixed is what you are after unless you are trying to pin the ‘bar’ to the top of the page…irrespective of anything else.

    #167315
    pauloreal
    Participant

    Paulie, thank you for your answer. I dont’t want to pin the bar to the top of the page. I’m looking for a kind of an affix solution for a sidebar. Basically i want to know if it is possible to make a div 100% width of it’s parent withou overlap the scrollbar.

    #167323
    Paulie_D
    Member

    Any div will automatically be 100% width of it’s parent.

    Still not seeing what you are trying to do….why would there be a scrollbar?

    Where would the scrollbar be?

    You mean like this?: http://jsfiddle.net/Paulie_D/4bGqF/872/

    #167328
    pauloreal
    Participant

    When you scroll, i want that div fixed so the content scrolls behind it.
    http://jsfiddle.net/4bGqF/873/

    In your example, with position absolute the div with the id fixed doesn’t have a fixed behaviour.

    I’m just asking if it is possible to achieve what you did with position absolute using position: fixed.

    #167334
    Paulie_D
    Member

    I’m just asking if it is possible to achieve what you did with position absolute using position: fixed.

    Not really (AFAIK) because fixed positioning is positioned to the window…not the parent div.

    Of course, there may be a way with JS.

    #167367
    pauloreal
    Participant

    Thank you guys. That was not the effect i was looking for but i will develop that approach.

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