gpt4 book ai didi

css - 媒体查询不适用于手机

转载 作者:太空宇宙 更新时间:2023-11-04 04:19:52 25 4
gpt4 key购买 nike

我使用媒体查询以使我的网站“自适应” - 当我恢复浏览器窗口并缩小它的大小时 - 一切正常,但在移动设备上 - 该网站看起来不正确,作为完整的桌面版本,但有错误.

我在想由此引起的问题:当你进入我的网站时,你会看到它可以向右滚动,而该区域显然没有元素(显示或隐藏),但我可以'摆脱这个可滚动空间:/

提前致谢,抱歉问了这么乱的问题。

这是网站:spalshmedia(dot)me

这是CSS:

body {
background-image: url("../images/background.jpg");
background-size: 20%;
background-repeat: repeat;
}

#page_wrap {
width: 1000px;
margin: 0 auto;
position: center absolute;
}

.button {
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.button:hover {
-webkit-filter: contrast(140%);
}
.websites {

border: 0.8px solid #666666;
}

#bg_first {
position: relative;
left: 0px;
top: 100px;
z-index: 1;
}
#bg_second {
position: relative;
left: 0px;
top: 25px;
z-index: 1;
}
#header {
width: 1000px;
margin:0 auto;
text-align:left;
position: center absolute;
overflow: hidden;
}

#headerbg {
position: absolute;
margin-top: 100px;
z-index: 2;
}
#glass_upper_left {
position: absolute;
margin-left: -400px;
margin-top: -240px;
z-index: 2;
}
#logo {
position: absolute;
padding-left: 50px;
top: 100px;
z-index: 3;
}
#generic_ideas {
position: absolute;
margin: 200px 300px;
z-index: 3;
}
#welcome_page {
position: absolute;
width: 500px;
margin-left: 10%;
margin-top: -600px;
z-index: 10;
}
#about_page {
position: absolute;
width: 600px;
margin-left: 10%;
margin-top: -275px;
z-index:10;
}
#services_page {
position: absolute;
width: 400px;
margin-left: 10%;
margin-top: 100px;
z-index: 10;
}
#rates_text {
position: absolute;
margin-left: -25px;
}
#contact_page {
position: absolute;
margin-left: 475px;
margin-top: 175px;
z-index: 10;
}
#contact_info {
position: absolute;
width: 800px;
height: 500px;
}
#navigation {
float: left;
position: fixed;
top: 400px;
left: 15px;
z-index: 4;
}
#menu_bg {
position: fixed;
width: 160px;
top: 370px;
left: 0px;
z-index: 3;
}

#footer_bg {
position: absolute;
margin-top: -100px;
margin-left: 0px;
z-index: 2;
}
#copyright {
position: absolute;
margin-top:-25px;
margin-left: 30px;
z-index: 10;
}
@media screen and (max-width: 1200px) {
nav, #menu_bg {
display:none;
}
#logo {
position: absolute;
padding-left: 30%;
}
#generic_ideas {
position: absolute;
margin: 200px 27%;
z-index: 3;
}
}
@media screen and (max-width: 720px) {
nav, #menu_bg {
display: none;
}
#generic_ideas {
position: absolute;
margin: 200px 70px;
z-index: 3;
-webkit-transform: scale(1.5); /* Saf3.1+, Chrome */
-moz-transform: scale(1.5); /* FF3.5+ */
-ms-transform: scale(1.5); /* IE9 */
-o-transform: scale(1.5); /* Opera 10.5+ */
transform: scale(1.5);
/* IE6–IE9 */
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.9999619230641713, M12=-0.008726535498373935, M21=0.008726535498373935, M22=0.9999619230641713,SizingMethod='auto expand');
}
#bg_first {
position: relative;
margin-left: 0px;
top: 100px;
z-index: 1;
}
#bg_second {
position: relative;
margin-left: -200px;
top: 25px;
z-index: 1;
}
#logo {
position: absolute;
padding-left: 10%;
}
#generic_ideas {
position: absolute;
margin-top: 200px;
margin-left: 5%;
z-index: 3;
}
#welcome_page {
position: absolute;
width: 400px;
margin-left: 10%;
margin-top: -650px;
z-index: 10;
}
#about_page {
position: absolute;
width: 450px;
margin-left: 10%;
margin-top: -375px;
z-index:10;
}
#services_page {
position: absolute;
width: 400px;
left: 10%;
top: 850px;
z-index: 10;
}
#web_design_title {
position: relative;
margin-left: 115px;
}
#rates_text {
position: absolute;
width: 400px;
margin-left: -10%;
margin-top: 190px;
}
#contact_page {
position: absolute;
margin-left: 475px;
margin-top: 175px;
z-index: 10;
}
#contact_info {
position: absolute;
width: 800px;
height: 500px;
margin-left: -500px;
margin-top: 240px;
}

}

最佳答案

我只看到一个媒体查询在屏幕宽度为 720px 及以上时产生布局更改,一个为 1200px 及以上。看起来您需要添加更多针对屏幕较小的设备的媒体查询。尝试此链接以获取更多信息:http://css-tricks.com/snippets/css/media-queries-for-standard-devices/

关于css - 媒体查询不适用于手机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19282516/

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