我有密码
<html>
<head></head>
<body>
<div id="main"> Hello world.!</div>
</body>
</html>
和CSS
body{
background-color: black;
}
#main{
padding: 10px;
background-color: blue;
}
请帮我弄个 100% 高度的背景。寻找 jsfiddle 链接。
最佳答案
.center-element {
min-height: 100%;
min-height: 50vh;
display: flex;
align-items: center;
justify-content: center;
-ms-flex-direction: column;
flex-direction: column;
}
关于html - 如何使背景为浏览器高度 100% 的 DIV 中没有任何内容或内容较少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27854984/