gpt4 book ai didi

html - CSS3 根据屏幕大小/显示重新调整页面大小

转载 作者:太空宇宙 更新时间:2023-11-04 05:00:45 26 4
gpt4 key购买 nike

如何让我的页面对齐以适应任何屏幕尺寸,例如,查看此链接以更好地理解 https://dl.dropbox.com/u/8542058/Photo%20Jul%2012%2C%209%2056%2026.png如果您注意到,在上面的链接中,调整屏幕后,屏幕上的图像会自行调整并相应地采用屏幕的形状。现在我想对我的页面做同样的事情,我的演示页面可以在 http://jsfiddle.net/529Lk/show/ 上找到, 代码为 http://jsfiddle.net/529Lk/ .谢谢

为了方便查看,我的代码还在这里:

CSS3:

body{
font-family: Arial, "MS Trebuchet", sans-serif;
color:#000;
background:#088A08;
font-weight: bold;
margin:auto;
}
/* SLIDE Start */

input[id=slideThree] {
visibility: hidden;
}

/* SLIDE THREE */
.slideThree {
width: 120px;
height: 45px;
background: #0101DF;

-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
position: relative;

-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
position:relative; left:450px;
}

.slideThree:after {
content: 'OFF';
font: 19px/26px Arial, sans-serif;
color: #fff;
position: absolute;
right: 10px;
z-index: 0;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}

.slideThree:before {
content: 'ON';
font: 19px/26px Arial, sans-serif;
color: #fff;
position: absolute;
left: 10px;
z-index: 0;
font-weight: bold;
}

.slideThree label {
display: block;
width: 50px;
height: 40px;

-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;

-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-o-transition: all .4s ease;
-ms-transition: all .4s ease;
transition: all .10s ease;
cursor: pointer;
position: absolute;
top: 3px;
left: 3px;
z-index: 1;

-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}

.slideThree input[type=checkbox]:checked + label {
left: 68px;
}

.back { width:598; height:95px; background:url('http://i1159.photobucket.com/albums/p637/Apulo_Cosmas/btn_push01c2x.png') no-repeat; }

HTML:

<div class="back" id="toggle"><br/>
<label for="enjoy_web"></label>
<div class="slideThree">
<input type="checkbox" value="None" id="slideThree" name="check" />
<label for="slideThree"></label>
</div>
</div>

<br/><br/><br/>

<img src="http://i1159.photobucket.com/albums/p637/Apulo_Cosmas/btn_push01a2x.png"/>​

最佳答案

如果你的意思是如果我缩小浏览器,它仍然适合吗?这就是您所说的流体宽度样式。这可以通过使用宽度百分比来完成。

另一方面,如果您想根据屏幕分辨率将不同的样式应用到您的页面,那么您可以使用媒体查询:http://webdesignerwall.com/tutorials/css3-media-queries

关于html - CSS3 根据屏幕大小/显示重新调整页面大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11572274/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com