因为我的网络项目很重要,所以我的div的宽度等于hight,反之则不然,因为高度是相对的且设置为80%。就像是:
.key{
position: relative;
display: inline-block;
height: 80%;
width: *height*;
border: none;
cursor: pointer;
}
感谢帮助。
有一种使用CSS的方法!
如果您根据父容器设置宽度,则可以将高度设置为0,并将padding-bottom设置为将根据当前宽度计算的百分比:
.key {
position: relative;
display: inline-block;
border: none;
cursor: pointer;
padding-bottom: 20%;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句