[英]Resize Div pure CSS if possible
I have the following HTML structure: 我有以下HTML结构:
<div class="outer">
<div class="inner">
<a href="#"/>
<a href="#"/>
<a href="#"/>
</div>
</div>
And CSS: 和CSS:
div.outer{
position:relative;
height:177px;
width: 495px;
margin: 0 10px 0 10px;
overflow: hidden;
}
div.inner{
position: absolute;
}
How is it possible to resize the outer div dinamically ? 如何动态地调整外部div的大小? Height min-max does not work.
高度最小-最大不起作用。 Thank you !
谢谢 !
For this to work the way I think you want it to work, then you'd need to use all three declarations: min-height
, height
and max-height
, with the height
being a relative measure, and the min-height
and max-height
both used to constrain that relative sizing to an appropriate minimum or maximum. 为了使它按我认为您希望的方式工作,那么您需要使用所有三个声明:
min-height
, height
和max-height
,其中height
是相对度量,而min-height
和max-height
都用于将相对大小限制为适当的最小值或最大值。 For example: 例如:
.outer {
overflow: auto;
margin: 0 auto;
width: 50%;
border: 2px solid #000; /* The above just for aesthetics, adjust to change */
min-height: 100px;
height: 50%;
max-height: 1000px;
}
In the demo, resize the window to cause the 'preview' pane to expand/contract to see the effects. 在演示中,调整窗口大小以使“预览”窗格扩展/收缩以查看效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.