When i use percentage to set the width and the height of a div, is the div going to be dinamic? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When i use percentage to set the width and the height of a div, is the div going to be dinamic?

I mean by dinamic div,that the div will adapt to the screen resizing.

27th Nov 2018, 9:23 AM
Isa Vladimirova Angelova
Isa Vladimirova Angelova - avatar
2 Answers
+ 1
Yes, but his width and height depend on the size of his parent (you have to set it). For example if I want a div just inside html tag of width 50% of the screen i have first to declare the width of html (setting 100 % in html or body tag means that body and html cover all the page) https://code.sololearn.com/WMl4bqR9V8mm/?ref=app
27th Nov 2018, 9:30 AM
Edoardo Tolotti
Edoardo Tolotti - avatar
+ 2
yes
27th Nov 2018, 9:29 AM
AliR૯za
AliR૯za - avatar