Forums

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

Home Forums CSS how to adjust the height to auto after it passes 100%?

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

    I have a page and I wanted to change height:100%; to height:auto; when the page height passes 100%, so the height will be adjust by the content.

    Thanks.

    #198504
    Paulie_D
    Member

    I’m not sure what you are asking.

    Firstly. all pages height (absent other setting) is defined by the height of the content.

    If you want the minimum height to be 100%, THAT you can do.

    However, without any details of your current HTML & CSS it’s hard to provide further help.

    A very brief demo in Codepen.io would be helpful just showing the basic outline HTML and relevant CSS.

    #198575
    alialnoaman
    Participant

    this is a picture showing the problem: http://i.imgur.com/z2gQHzy.png

    look at the border

    the contents is getting out of the

    <

    div style=’height:100%;border:1px solid gray’>

    I meant, if the page height is more than height:100%; then change the height to height:auto; so the contents height fit in.

    #198579
    Senff
    Participant

    Like Paulie said: use min-height:100%; instead.

    If the content is less than 100% high, the block will be set at 100%. If it’s more than that, it will have an auto height.

    But if you insist of having inline styles and switching out height:100%; to height:auto;, you’re gonna have to use some Javascript or jQuery.

    #198580
    Paulie_D
    Member

    See a div with a min-height of 100% – http://jsfiddle.net/khta6dzj/2/

    Full it with a bunch of content – http://jsfiddle.net/khta6dzj/3/

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