[英]css media query applying to full size page
I'm using media queries on my page for smaller screens but it's applying when the page is in full size. 我在页面上使用媒体查询以获取较小的屏幕,但在页面全尺寸显示时会应用媒体查询。 when the page is in full size I have the
h1
at 5rem
but it shows in 2.5rem
. 当页面全尺寸时,我的
h1
为5rem
但显示为2.5rem
。 Thank you in advance. 先感谢您。
@media (min-width: 375px) {
.container {
padding: 0 2rem 0 2rem;
}
.container h1 {
font-size: 2.5rem;
}
}
@media (max-width: 375px) {
.container {
padding: 0 2rem 0 2rem;
}
.container h1 {
font-size: 2.5rem;
}
}
min-width for bigger screen. 最小宽度用于更大的屏幕。 For smaller screen use max-width
对于较小的屏幕,请使用最大宽度
specify screen
to your css media query and also use max-width
and not min-width
为您的CSS媒体查询指定
screen
,并且还使用max-width
而不是min-width
@media screen and (max-width: 375px) {
.container {
padding: 0 2rem 0 2rem;
}
.container h1 {
font-size: 2.5rem;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.