给你一个美好的一天。我正在网页上工作,但我被困在定义最大和最小宽度。基本上我希望我的页面能够像大多数网页一样缩小网页的中心位置。请需要专家的帮助.ASAP谢谢。css3缩小页面时的最小 - 最大宽度
body
{
height:100%;
width:100%;
margin:0 auto;
background-image: -webkit-linear-gradient(top, #E5E5E5 30%, #999);
background-image: -moz-linear-gradient(top, #E5E5E5 30%, #999);
background-image: linear-gradient(top, #E5E5E5 30%, #999);
}
#mainContainer
{
background-image:url(bg3.jpg);
background-repeat:repeat;
background-color:#999;
width:70%; /*default width in percent for a liquid layout.
the problem is when I zoom out the page the width remains to be in 70% therefore forcing the contents to be pushed to the left corner instead of being centered.*/
min-width:940px;
margin:5px auto;
height:100%;
padding:0 1% 0 1%;
-webkit-border-radius: 10px;
border-radius: 10px;
}
感谢您的澄清,并采取了一些时间寻找到这一点。那么它会改进我的页面布局。哦,这些网页集中在你身上?基本上它在缩小时确实处于中心位置,但与我的位置有点不同。当你缩小容器尺寸时,容器的尺寸会保持在原来的位置,但是我希望当我缩小尺寸时,宽度本身也将流畅地适应缩小而不仅仅是内容。它就像压缩宽度大小的内容一样。 – Teffi
如果我理解正确,当宽度超过940像素时,您希望#maincontainer拉伸,对吗?如果容器宽度的70%大于最小宽度(940px),它现在正在拉伸。所以如果你的屏幕宽度超过1350px,#mainWidth将开始变宽。如果你想在940px之后开始伸展,你需要改变“width:70%;”到“宽度:100%”;“或类似的东西 –
我想让#maincontainer限制其宽度,因此压缩它的所有内容,将它全部移动到中心位置 - 这里是它的快照最初看起来像。 - > [link] http://tinypic.com/r/28wjcci/5 - 然后当我缩小浏览器时它看起来像什么。[link] http://tinypic.com/r/ 102qlcn/5 - 这是我想要它看起来像什么时候缩小。[link] http://tinypic.com/r/2v2uuea/5。 – Teffi