Forums

Give help. Get help.

  • # May 3, 2013 at 12:04 pm

    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”)

    # May 3, 2013 at 12:07 pm

    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.

    # May 3, 2013 at 12:26 pm

    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.

    # May 3, 2013 at 1:40 pm

    Do you mean a centered dialog?

    # May 3, 2013 at 2:39 pm

    With some jQuery: http://codepen.io/senff/pen/xCBsn

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag