媒体查询问题:字体大小在手机上不变

问题描述 投票:0回答:1
html media-queries font-size
1个回答
0
投票

只需删除以下媒体查询:-

@media (min-width:320px) { 
    /* smartphones, iPhone, portrait 480x320 phones */   
    p.Description {
        font-size: 36px;
    }
}

而不是这个,添加这个:-

    p.Description {
        font-size: 36px;
    }

这会将字体大小设置为 36px。当 screen width 达到 481px,然后由于 other media query 字体大小变为 16px.

总体更新的代码是:-

/* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ 
p.Description {
  font-size: 36px;
}

@media (min-width:481px) {
   /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ 
    p.Description {
       font-size: 16px;
    }
}

@media (min-width:641px) {
    /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ 
    p.Description {
        font-size: 16px;
    }
}

@media (min-width:961px) { 
    /* tablet, landscape iPad, lo-res laptops and desktops */ 
    p.Description {
        font-size: 16px; 
    }
}

@media (min-width:1025px) {
    /* big landscape tablets, laptops, and desktops */ 
    p.Description {
        font-size: 26px; 
    }
}

@media (min-width:1281px) { 
    /* hi-res laptops and desktops */ 
    p.Description {
        font-size: 16px;
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.