我的媒体查询在开发中工作,但当我在生产中查看时,它不会响应字体大小的媒体查询.我正在查看iPhone 13上的产品版本,我怀疑这个问题可能只针对移动设备.我对这个项目使用了REACTION 18,并通过在Netlify上放置一个构建文件夹来手动部署.
我的HTML中有适当的meta标记,
<meta name="viewport" content="width=device-width, initial-scale=1" />
我在css中对我的媒体查询有适当的层次 struct ,
/* ////////////////// */
/* ! MEDIA QUERIES XS DEVICES */
/* ////////////////// */
@media (max-width: 380px) {
.include span {
word-spacing: 6px;
font-size: 1.1rem;
}
.medium-contianer {
font-size: 0.9rem;
}
}
@media (max-width: 370px) {
.medium-contianer,
.strength,
.bar-container {
margin: 0 0.35rem;
font-size: 0.85rem;
}
}
@media (max-width: 330px) {
.include span {
word-spacing: 4px;
font-size: 0.9rem;
}
}
@media (max-width: 320px) {
.medium-contianer,
.strength,
.bar-container {
margin: 0 0.35rem;
font-size: 0.75rem;
}
.include span {
word-spacing: 4px;
font-size: 0.8rem;
}
}
@media (max-width: 300px) {
.medium-contianer,
.strength,
.bar-container {
margin: 0 0.1rem;
font-size: 0.7rem;
}
.include span {
word-spacing: 4px;
font-size: 0.8rem;
}
}
/* ////////////////// */
/* ! MEDIA QUERIES TABLET DEVICES */
/* ////////////////// */
@media (min-width: 550px) {
.main-container {
width: 80vw;
margin: 2rem auto;
}
}
/* ////////////////// */
/* ! MEDIA QUERIES DESKTOP DEVICES */
/* ////////////////// */
@media (min-width: 768px) {
.medium-contianer,
.strength,
.include span {
font-size: 1.35rem;
}
}
@media (min-width: 900px) {
.main-container {
width: 50vw;
margin: 2rem auto;
}
.strength-container {
height: 2rem;
}
}
@media (min-width: 1700px) {
.main-container {
width: 25vw;
margin: 50rem auto;
transform: scale(2);
}
}
在所有Chrome Dev工具媒体显示中,它的格式完全按照我想要的方式进行.然而,当我在手机上查看制作版本时,没有一个媒体询问是完好无损的.
链接到我的回购 https://github.com/cassius2828/password-generator/tree/main/src个
指向已部署应用程序的链接 https://password-generator-creynolds.netlify.app/个