gpt4 book ai didi

css - 媒体查询冲突

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

我在不同的设备上使用媒体查询来修改我的 css,但是,当我对第二个媒体查询(最大宽度:767)进行更改时,它会覆盖移动设备的 css。有人知道为什么会这样吗?

这是CSS:

/* Mobile */

@media only screen and (min-width: 320px) and (max-width: 480px) {
/* Style adjustments for viewports 480px and under go here */
.row {
text-align: center !important;
margin-left: auto !important;
margin-right: auto !important;
width: 98% !important;
padding-left: 1% !important;
padding-right: 1% !important;
}

span {
letter-spacing: 20px !important;
}

.nav li {
margin-right: 22px !important;
text-align: center !important;
letter-spacing: 2px !important;
}

ul li:last-child {
margin-right: 0px !important;
}

.intro h1 {
font-size: 44px !important;
margin-bottom: -40px !important;
}

.intro img {
visibility: hidden !important;
}

.dotted_line {
visibility: hidden !important;
}

.cta {
height: 450px !important;
width: 330px !important;
margin-top: -30px !important;
margin-bottom: -250px !important;
}

.cta h2 {
font-size: 20px !important;
margin-left: 5px !important;
margin-top: -10px !important;
}

.cta p {
font-size: 16px !important;
margin-left: 5px !important;
margin-top: -10px !important;
}

.home_form {
margin-left: 20px !important;
}

.left input {
width: 280px !important;
margin-bottom: 10px !important;
}

.right {
width: 280px !important;
float: none !important;
}

.right textarea {
height: 120px !important;
width: 285px !important;
}

.submit {
background: url('../img/submit_btn.png') no-repeat !important;
float: left !important;
margin-top: 20px !important;
}

.social {
visibility: hidden !important;
}

.social_icons {
margin-right: auto;
margin-left: auto;
}

footer .left p {
width: 330px !important;
}

footer .middle {
visibility: hidden;
}

footer .right {
visibility: hidden;
}

.copyright {
margin-left: 10px !important;
margin-bottom: -40px;
}
}

@media only screen and (max-width: 767px) {
body { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; width: 100%; min-width: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

.container { min-width: 0; margin-left: 0px; margin-right: 0px; }
.row { width: 100%; min-width: 0; margin-left: 0; margin-right: 0; }
.row .row .column, .row .row .columns { padding: 0; }
.column, .columns { width: auto !important; float: none; margin-left: 0; margin-right: 0; }
.column:last-child, .columns:last-child { margin-right: 0; float: none; }
.row .row .column, .row .row .columns { padding: 0; }
.column, .columns { width: auto !important; float: none; margin-left: 0px; margin-right: 0px; }
.column:last-child, .columns:last-child { margin-right: 0; float: none; }
[class*="column"] + [class*="column"]:last-child { float: none; }
[class*="column"]:before, [class*="column"]:after { display: table; }
[class*="column"]:after { clear: both; }


.push_one, .push_two, .push_three, .push_four, .push_five, .push_six, .push_seven, .push_eight, .push_nine, .push_ten, .push_eleven, .centered { margin-left: 0% !important; }

span {
letter-spacing: 40px !important;
}

.nav li {
margin-right: 62px !important;
text-align: center !important;
letter-spacing: 6px !important;
}

ul li:last-child {
margin-right: 0px !important;
}

.intro h1 {
font-size: 44px !important;
margin-bottom: -40px !important;
}

.intro img {
visibility: hidden !important;
}

.dotted_line {
visibility: hidden !important;
}

.cta {
height: 450px !important;
width: 330px !important;
margin-top: -30px !important;
margin-bottom: -250px !important;
}

.cta h2 {
font-size: 20px !important;
margin-left: 5px !important;
margin-top: -10px !important;
}

.cta p {
font-size: 16px !important;
margin-left: 5px !important;
margin-top: -10px !important;
}

.home_form {
margin-left: 20px !important;
}

.left input {
width: 280px !important;
margin-bottom: 10px !important;
}

.right {
width: 280px !important;
float: none !important;
}

.right textarea {
height: 120px !important;
width: 285px !important;
}

.submit {
background: url('../img/submit_btn.png') no-repeat !important;
float: left !important;
margin-top: 20px !important;
}

.social {
visibility: hidden !important;
}

.social_icons {
margin-right: auto;
margin-left: auto;
}

footer .left p {
width: 330px !important;
}

footer .middle {
visibility: hidden;
}

footer .right {
visibility: hidden;
}

.copyright {
margin-left: 10px !important;
margin-bottom: -40px;
}

}

除了 span 和 .nav li 之外,我没有对第二个媒体查询做太多调整,但这足以在标题和导航中看到问题。

最佳答案

因为 @media only screen and (max-width: 767px)还解决了屏幕宽度为 320px <= x <= 480px 的设备.你需要设置一个 min-width: 481px在这里。

关于css - 媒体查询冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15506515/

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