我正在使用媒体查询在不同的设备上修改我的 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;
}
}
除了跨度和 .nav li 之外,我没有对第二个媒体查询进行很多调整,但这足以在标题和导航中看到问题。