Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do computed styles for width and height come from when they aren't listed in my css

Obviously I can open display and it will tell me exactly where these are listed, but where do the fields with no arrow (in this case height and width) come from? afaik these values are not listed anywhere in my css. Is this clientWidth and clientHeight?

enter image description here

like image 548
Shanimal Avatar asked Nov 13 '22 09:11

Shanimal


1 Answers

The default value of width for a block element like a div or a p is auto in CSS 2.1 (nope, it isn't 100%)

Thus what you see is (veeeery roughly speaking) the width of the parent (taking into account borders, padding, margin, box-sizing and so on).
There are many other cases explained in CSS 2.1 REC Visual formatting model details

like image 163
FelipeAls Avatar answered Dec 12 '22 10:12

FelipeAls