Is it not working like you envisaged? You said your version was working in Chrome and the version I posted works in the same manner as yours in both Chrome and Firefox. I may be misunderstanding what you want to accomplish though. The only way to set a percentage height is for the pare...
In fact, you can set flex-basis to any value except 'auto' , according to CSS2.1 : If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'. A percentage height...
min-height - CSS 中对其的描述:Percentages:The percentage is calculated with respect to the height...
+ * If the height of the containing block is not specified explicitly + * (i.e., it depends on content height), and this element is not absolutely positioned, + * the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). + */ + if ( mb_strpo...
比如child 设置 height / max-height: 50% 那么 parent 的 height 就不可以是 auto, max-height percentage 是 depend on parent height 而不是 max-height 哦 参考:stackoverflow – Percentage Height HTML 5/CSS 这也是最常踩的坑了. 有时候不得不 wrapper 一层的时候要特别小心, 有时也可以把 percentage...
css:#holy { height: 100%; } #shit { height: 100%; } 参考:css - Why can't I make ...
Thekeywordvalues always set the size of the content box (they are not affected by thebox-sizingproperty). This doesn't apply tolengthandpercentagevalues. In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value: ...
<percentage>将高度定义为包含块高度的百分比。border-box如果存在,前面的<length>或者<percentage>应用于元素的边框。content-box如果存在,前面的<length>或<percentage>应用于元素的内容框。auto浏览器将计算并为指定的元素选择一个高度。填充使用fill-available内嵌大小或fill-available块大小,以适应写入模式。max-...
I realise this is an old post, but given that it hasn't been suggested it is worth mentioning that if you are writing for CSS3-compliant browsers, you can usecalc: height: calc(100% - 18px); It's worth it to note that not all browsers currently support the standard CSS3 calc() ...
<viewport-length>{1,2}where <viewport-length> = auto | <length-percentage> where <length-percentage> = <length> | <percentage> 示例 @viewport { height: 500px; } 规范 Specification Status Comment CSS Device AdaptationThe definition of '"height" descriptor' in that specification. ...