简体   繁体   English

基于离子平台的条件SCSS.height

[英]Conditional SCSS based on ionic platform.height

Is there a way to have the scss code respond to the platform height? 有没有办法让scss代码响应平台高度?

In ionic I get the platform height as follows: 在ionic中,我得到的平台高度如下:

this.platform.height()

I have a class in my app.core.scss file that I would like to have the max-width set to 100% if the platform height is >480 and to 50% if the platform height is <=480 我的app.core.scss文件中有一个类,如果平台高度> 480,我希望将max-width设置为100%,如果平台高度<= 480,我希望将max-width设置为50%

@Bill: Try media query first. @Bill:首先尝试媒体查询。 But what do you mean by platform height ? 但是,平台高度是什么意思? Is this device screen height? 该设备的屏幕高度是多少?

@media screen and (max-height: 480px){
    .CLASS-TO-BE-SET {
        width: 50%;
    }
}

@media screen and (min-height: 481px){
    .CLASS-TO-BE-SET {
        width: 100%;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM