我有一个网页如下图所示。
我想让蓝、红、白三种颜色的渐变填满整个屏幕高度。目前,我在内容容器的两侧放置了两个旗帜,它们都被一个主容器包围着。
![enter image description here](https://istack.dev59.com/BgvJL.webp)
.container{
width: 100%;
background: -webkit-linear-gradient( $blueToRed);
background: -o-linear-gradient($blueToRed);
background: -moz-linear-gradient($blueToRed);
background: linear-gradient($blueToRed);
margin-bottom: -99999px;
padding-bottom: 99999px;
overflow: auto;
}
位于firstContain内部
.firstContain{
border-left: 4px solid white;
border-right: 4px solid white;
background: #FFF;
max-width: 980px;
position: relative;
display: block;
margin: 0 auto;
overflow: auto;
z-index:1000;
}
我想要使容器高度达到100%,但添加后并没有变化。我尝试使用99999的margin padding 技巧,它确实起作用了,但我失去了一些让它工作的css。欢迎任何帮助。提前感谢您对我做错的建议。
.container
是body
的直接子元素,你可能还需要添加html,body,.container { height: 100%; }
。但是如果没有看到你代码的其他部分,很难确定。 - undefined