我可以设置一个child-div
的宽度等于它的parent-div
高度纯CSS?一组孩子的宽度父的纯CSS高度
到目前为止,我一直在做jQuery中:
$("#child-div").width($("#child-div").parent().height());
是在纯CSS这达到了么?出于某些原因,我需要这个在纯CSS中。 这里是我的html:
<div id="parent-div">
<div id="child-div>Hello</div>
</div>
和CSS:
#parent-div{
background:#ddd;
height:80%;
width:30%; position:absolute;
}
#child-div{
position:relative;
background:#333;
color:#FFF;
transform: rotate(270deg);
transform-origin: 0 0 ;
top:100%;
height: /* What ???? */;
}
什么花样?
你为什么不在jQuery中做到这一点? – 2014-10-12 01:11:37
@selu我需要这是CSS,请阅读这个问题。它是动态的。否则,我将不得不在窗口大小调整时进行jquery evry。 – tika 2014-10-12 01:12:44