Problem with height in HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Problem with height in HTML

Hi everyone! I have trouble setting up the height of the elements with CSS in my html file. The problem is that I use percentage instead of pixels in order to make the size of the content responsive to the size of the window, I had no trouble when I started the document with my <html> tag, but then I started them with the <!DOCTYPE html> tag since it is mandatory so the browser can recognize the type of document, when I tried to set the height of a div to 100% it didn t show up until I wrote content in it. Can someone help me please?

5th Sep 2019, 2:11 PM
Ariel Calderon
Ariel Calderon - avatar
1 Answer
+ 7
if you want the div to have the height of the window you must use 100vh. That would be 100% of the window's height. 100vw would be the same but for the window pa width.
5th Sep 2019, 2:21 PM