Home >Web Front-end >HTML Tutorial >How to make a page height occupy the entire screen_html/css_WEB-ITnose

How to make a page height occupy the entire screen_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:53:282308browse

For example, I am now making a login interface. I want to make the entire page full screen according to the different screen sizes of users.
I set height: 100%, which is invalid. The width is still the same. Yes, thank you

It is said that you can use js to get the resolution of the current user first, and then set it
I don’t know how, and I don’t think this method is easy to use.
Is there any other way? If so How to do it if the front end does not know js?


Reply to the discussion (solution)

First define

html{
height:100%
}

Earlier versions of ie may not support

First define

html{
height:100%
}

ie early version The version may not support






< body>






Here I want the height of the div with id=left to be the width of the screen. How to do it
html{

height: 100%
}

Add in

html{

height:100%
}

Add in


It still doesn’t work after adding it
In fact, it’s not necessary. You just need to place your elements. Just like the login page, there are few elements. Basically, height:auto is enough. Of course, you can also get the user resolution first. It’s just more troublesome to set the width and height with the rate

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn