【发布时间】:2020-09-26 18:30:28
【问题描述】:
我正在设计一个网站,并按照我的意愿拥有它,直到我添加了媒体查询...... 它只是一个针对 860 像素及以下设备的媒体查询(最大宽度:860 像素)...
然而媒体查询不知何故甚至在更宽的屏幕上生效,实际上弄乱了我的整个布局......我将它放在单独的 .css 文件中,因为我想检查如果我不链接一切看起来是否正常媒体查询 .css 文件 - 是的 - 没有它一切都很好......
我真的不明白是什么导致了媒体查询的行为如此。我在发布此问题之前进行了搜索,但找不到此特定问题。
请谁能帮我解决这个问题?这是我的 media.css -
@media (max-width: 860px) {
.navbar span {
display: none;
}
.navbar h2 {
display: none;
}
.navbar img {
width: 50px;
/* padding: 0 15px; */
display: flex;
flex-direction: row;
}
.navbar {
display: flex;
justify-content: space-between;
}
.hide {
display: none;
}
.section-1 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
}
.mobile-img {
display: block;
width: 100%;
margin-bottom: 0;
}
.section-1-content {
display: block;
width: 100%;
margin: 0;
}
.section-1 h1 {
font-size: 10vw;
line-height: 10vw;
margin-top: -8vw;
}
.section-1 p {
font-size: 5vw;
line-height: 6vw;
}
.section-1 .btn {
background-color: #9b9b9b;
width: 100%;
}
.section-2-left {
display: none;
}
.section-2 {
display: flex;
flex-direction: column;
width: 100%;
}
.section-2 .content-right {
display: inline-block;
width: 100%;
}
.box-side {
display: block;
border: none;
}
.section-2 .box-side-text {
display: flex;
flex-direction: column;
width: 100%;
}
.section-2 h4 {
font-size: 5vw;
padding-bottom: 2vw;
}
.section-2 p {
font-size: 4vw;;
}
.section-2 a {
font-size: 4vw;;
}
.section-3 h3 {
font-size: 7vw;
font-weight: 780;
}
.section-3 {
/* display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%; */
}
/* .grid {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 90%; */
}
.box {
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.row-1, .row-2, .text-wrap-grid {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.text-wrap-grid {
background-color: #d8d8d8;
}
/* display: block; */
/* display: flex;
flex-direction: column;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
*/
.section-3 h4 {
font-size: 3.5vw;
}
.section-4 h3 {
font-size: 7vw;
font-weight: 780;
}
.section-4-all {
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
.section-4-left {
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
}
video {
width: 100%;
}
}
【问题讨论】:
标签: css responsive-design media-queries responsive