Forums

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

Home Forums CSS Extending an absolutely positioned div to content height

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44533
    fooman
    Participant

    Is there a way in CSS to allow an absolutely positioned element to extend to it’s content’s height?
    Because you allow the content to overflow, but the element stays the same height.

    Take a look at this and lemme know if I’m just missing something:
    [Codepen test case](http://cdpn.io/uBHad “Codepen link”)

    #133969
    Paulie_D
    Member

    To start…why are you using absolute positioning?

    You’ve told the parent to be a certain height and it’s obeying. The absolutely positioned element is just doing what you have told it to.

    What you seem to be trying to do is force the parent element to respect the height of the child and absolute positioning can’t do that.

    #133971
    Merri
    Participant

    You can do something like this: http://codepen.io/Merri/pen/bzCBD

    Practical uses for this are quite limited though. If you can define a better use case then answers may improve.

    #133980
    Merri
    Participant

    Do you mean a centered dialog?

    #133990
    Senff
    Participant
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.