HTML基础知识:为什么div不能缩放到100%(HTML Basics: Why is div not scaling to 100%)
我没有看到任何理由为什么这个片段不能扩展到100%的屏幕...有谁知道...我想是这样的...我只是不明白它在这里一个小提琴: http:/ /jsfiddle.net/uuzbv/
Untitled Documentbody{
width:100%;
height:100%;}
.section{
height:100%;
width:100%;
background-color:#000;
}
I don't see any reason why this snippet doesn't scale to 100 percent of the screen...does anyone know...i guess so...I just don't get it and here a fiddle: http://jsfiddle.net/uuzbv/
Untitled Documentbody{
width:100%;
height:100%;}
.section{
height:100%;
width:100%;
background-color:#000;
}
原文:https://stackoverflow.com/questions/9333925
更新时间:2019-12-01 10:10
最满意答案
使用:
body, html {
width:100%;
height:100%;
}
Use:
body, html {
width:100%;
height:100%;
}
相关问答
使用: body, html {
width:100%;
height:100%;
}
Use: body, html {
width:100%;
height:100%;
}
如果您是html2canvas的新手,我将在下面介绍一些可以帮助您入门的样板代码。 希望它可以帮助别人。
test2你可以这样翻译: var geometry= new THREE.CircleGeometry(0.05, 10, 0, Math.PI/2);
var translation = new THREE.Matrix4().makeTranslation(10, 0, 0);
geometry.applyMatrix(translation);
You can make a translation like this: var geometry= new THREE.CircleGeometry(
...
你只需要使用box-sizing:border-box html,
body {
height: 100%;
margin: 0
}
.blah {
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
background: #ffb3b3;
min-height: 100%;
padding: 10% 0;
box-
...
通过将每个div设置为position: fixed ,将每个div相对于视口放在彼此的顶部。 删除.overlay类,然后将它们显示在另一个下面。 如果你想一次只在屏幕上有一个没有滚动条,你就不得不求助于使用JavaScript。 这里有一个示例的链接,其中一个跟随另一个http://jsbin.com/UvOXUXI/1/ By setting each div to position: fixed you put each one of them on top of one another,
...
绝对位置的默认值是将left和top设置为0 ,以获得一个div在另一个下面,因为它们不在文档流中,或者使用相对位置(这会导致与空元素的其他问题,身体没有位置等): #second{
position:absolute;
top: 100%;
width:100%;
height:100%;
background:yellow;
}
小提琴 The default for position absolute is to set left and top
...
更换margin-left:-300px; right: calc(50% + 250px); 在.innerleft然后添加left: calc(50% + 250px); 到.innerright就可以了。 这里要做的是我将div的左侧和右侧的距离设置为通过调整页面大小或缩放页面无法更改的距离。 计算结果是侧面的50%,+中心div宽度的50%。 此解决方案仅在您具有不能/不会更改的中心div的静态宽度时才有效。 在这里小提琴 Replacing margin-left:-300px; wit
...
当你有一个viewBox时,内容将(默认情况下)尝试保持viewBox的宽高比。 您可以通过preserveAspectRatio =“none”禁用此功能。