移动设备的HTML响应字体大小

Nic*_*ckF 4 html5 android css3 ios responsive-design

我有一个在Android和IOS上运行的应用程序.
该应用程序有一些WebView组件显示HTML
从我发现有"em"和" viewport "单位以及css中的"@media".

我是HTML5和CSS3的新手,有人可以向我展示移动设备响应字体大小的示例.
对我来说最重要的是在手机和平​​板电脑之间有不同的字体大小,但在不同屏幕尺寸的移动设备之间(用于纵向和横向).

编辑:

WebView组件不是全屏,它们的大小与文本框相同,大小是动态的.

Mio*_*vic 8

用于媒体查询

HTML

<p class="fonts">Administrator</p>
Run Code Online (Sandbox Code Playgroud)

添加媒体查询

  @charset "utf-8";
    /* CSS Document */
    /* Smartphones (portrait and landscape) ----------- */
    @media only screen
    and (min-device-width : 320px)
    and (max-device-width : 480px) {
     .fonts
     {
      font-size: 75%;
     }    
    }
    /* Smartphones (landscape) ----------- */
    @media only screen
    and (min-width : 321px) {
     .fonts
     {
      font-size: 120%;
     }  
    }
    /* Smartphones (portrait) ----------- */
    @media only screen
    and (max-width : 320px) {
     .fonts
     {
      font-size: 120%;
     }  
    }
    /* iPads (portrait and landscape) ----------- */
    @media only screen
    and (min-device-width : 768px)
    and (max-device-width : 1024px) {
     .fonts
     {
      font-size: 120%;
     }    
    }
    /* iPads (landscape) ----------- */
    @media only screen
    and (min-device-width : 768px)
    and (max-device-width : 1024px)
    and (orientation : landscape) {
     .fonts
     {
      font-size: 150%;
     }    
    }
    /* iPads (portrait) ----------- */
    @media only screen
    and (min-device-width : 768px)
    and (max-device-width : 1024px)
    and (orientation : portrait) {

     .fonts
     {
      font-size: 120%;
     }  
    }
    /* Desktops and laptops ----------- */
    @media only screen
    and (min-width : 1224px) {
     .fonts
     {
      font-size: 156%;
     }    
    }
    /* Large screens ----------- */
    @media only screen
    and (min-width : 1824px) {
     .fonts
     {
      font-size: 200%;
     }    
    }
    /* iPhone 4 ----------- */
    @media
    only screen and (-webkit-min-device-pixel-ratio : 1.5),
    only screen and (min-device-pixel-ratio : 1.5) {
     .fonts
     {
      font-size: 190%;
     }    
    }
Run Code Online (Sandbox Code Playgroud)

我使用%作为字体大小,这里只是字体大小的例子,尝试并添加你认为最好的%