开发者

width/height 100%

Is it same like to omit width/height CSS properties and to specify them as 100%?开发者_开发百科


On some elements the width acts like 100% (e.g. a <div>, auto acts very similar to 100%, depending on margin/padding)....but not height, so no, it's not the same as omitting them everywhere.

Here's a demonstration with <div> width/height not set vs 100%.


width or height equals to 100% work  relative to parent element . 

this_example_maybe_useful


No, it's not the same. By default both of them are auto which is quite different. See the CSS specs (for example, from here onwards) for more information on how width and height are calculated when unspecified.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜