+ 1

why height don't work if I give % in one div?

when I give one div width:50% and height:40% the div don't show the given value; please tell me why? https://code.sololearn.com/WzmbVZh4pLTN/?ref=app

23rd Oct 2019, 4:16 PM
ND MORSALIN
ND MORSALIN - avatar
2 ответов
+ 5
Css % refers to parent tag width/height values, make sure parent tag width/height is set, before use % Try to add the following css: html, body { height: 100%; } body { width: 100%; }
23rd Oct 2019, 4:28 PM
Calviղ
Calviղ - avatar
+ 3
thanks
24th Oct 2019, 1:49 AM
ND MORSALIN
ND MORSALIN - avatar