出于某种原因,我无法在页面上设置最大高度。
以下是代码:
html
{
min-width: 100%;
min-height: 100%;
}
body
{
margin:0;
padding:0;
font-family: Arial, Helvetica, sans-serif;
background-color: darkblue;
height: 1200px;
}
.tile {
display: inline-block;
width: 300px;
height: 300px;
/*border: 1px solid black;*/
transition: 2s all linear;
margin-top: -4px;
margin-left: -4px;
}
这是JSFiddle:
http://jsfiddle.net/cty276x5/1/
此外,它应该在所有方向(宽度和高度)重复“正方形”,但在达到“背景高度/宽度限制”时会被切断。
那么为什么我不能像我那样限制身高呢?
答案 0 :(得分:1)
在.title
设置的身高等于100vh
height: 100vh;
答案 1 :(得分:0)
HTML
<body>
<div class="first-div"></div>
</body>
body {
width: 1000px
height: 2000px;
}
div.first {
width: 90%; // will 900px i.e. 90% of 1000px
height: 100%; // will be 2000px
}
因此当你说100%以上,你现在可以看到为什么CSS不知道你在问什么。我们都知道这是你的屏幕尺寸,但因为它是相对的,CSS不知道你的屏幕尺寸。
希望有所帮助。