I have a div like this.
<div> ... </div>
I want its height to be the height of the view port (not of the page)
is it possible to do this via CSS or do I have to write some javascript ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it’s possible. CSS percentage height will work as long as the parent element has a height defined. Assuming this is your markup:
This CSS will cause the
<div>to have the full height of the viewport:If you wanted the
<div>to expand with its content, the CSS would change as follows: