0

I am maaking a responsive app for all devices(sizes), I used the formula, target / context = result. For width i given 93.75% (900/960), when i used the same formula for height - 62.5% its not visible, If i used 600px for height that maincontent div is visible, how to fix this ?

Below is my code i tried,

<div class="maincontent"></div>

.maincontent{
width:93.75%;/*900/960*/
margin:5% 3.125%; /*30/960*/ 
height:62.5%;/*600*/
background:#2c3e50;
}
4

1 回答 1

2

我认为您为此付出的工作比您需要的要多,这就是我设置计算器的方式:

http://jsfiddle.net/TTQ4e/1/

使用百分比会很快变得混乱 - 请注意我使用的唯一百分比是 100%。

您可以通过执行以下操作使 div 在一定高度后可见

.myDiv {
    display:none;
}

@media (max-height:600px) {
    .myDiv {
        display:block;
    }
}

编辑

此外,您真正应该担心的唯一手持分辨率是:

320x480

480x320

360x640

640x360

768x1024

1024x768

800x1280

1280x800

于 2013-10-18T06:22:06.433 回答