Treehouse: Grow your CSS skills. Land your dream job.

Responsive Design – height

  • # July 15, 2012 at 11:22 am

    Sorry if this is a silly question but how do you set height of containers to be flexible and relative to the size of the device used? Do you simply convert pixels to percentages based on the parent container or is there more to it than that? I notice a lot of site don’t seem to set a height, apart from the body, at all.

    # July 15, 2012 at 2:05 pm

    Typically, height is defined by what is inside of it. So, without doing anything it’s dynamic on it’s own.

    # July 15, 2012 at 3:01 pm

    @JoshWhite – so by that do you mean padding and margins at relative values form the shape of the containers?

    # July 15, 2012 at 7:37 pm

    Height in itself, as Josh said, is dynamic,. So if you put a paragraph in it, the element will be has high as the paragraph dictates. If you want to use a 100% height for something, you have to set the html, body, and any other parent to 100% height first.

    # July 16, 2012 at 8:16 am

    So Overflow: hidden is the way to go.

    # August 18, 2013 at 8:52 am


    position: fixed;

    it’s work

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

You must be logged in to reply to this topic.