How browser calculate size for elements with percents width or height
How browsers calculate size for elements with percents width or height? I开发者_开发知识库s it calculated based on size of the parent node? What if parent node does not have explicit size attributes?
Yes it is calculated based on the parent node. Coming to your point if no explicit size has been given to the parent...Actually I have never done this so cannot guide you on that point.
But remember in case of font-size..if you do not specify any size then browsers go for some pre-defined settings. Every browser has a base font size..When you set a custom value of font-size then the browser actually adds or subtracts the values from that base size...
In short:
Yes its calculated on the basis of parent tag.
Its not safe to not give a custom size and rely on browsers pre-defined settings.
If you dont specify something mostly browsers fall back to their pre defined settings.
精彩评论