關於移動端的一些相容問題

來源:互聯網
上載者:User

標籤:ack   使用   phone   type   firefox   web   padding   minimum   狀態列   

 1、首先我們在使用Media的時候需要先設定下面這段代碼(寫在head標籤裡):

    <meta name="viewport" content="width=device-width,maximum-scale=1,user-scalable=no"/>   

    這段代碼的幾個參數解釋:

  • width = device-width:寬度等於當前裝置的寬度

  • initial-scale:初始的縮放比例(預設設定為1.0)  

  • minimum-scale:允許使用者縮放到的最小比例(預設設定為1.0)    

  • maximum-scale:允許使用者縮放到的最大比例(預設設定為1.0)   

  • user-scalable:使用者是否可以手動縮放(預設設定為no,因為我們不希望使用者放大縮小頁面) 

  • 2、CSS媒體查詢

      指定樣式表規則用於指定的媒體類型和查詢條件。設定在不同尺寸的裝置下的顯示內容。

    1. @media screen and (max-width: 960px){
    2.     body{
    3.         background: #000;
    4.     }
    5. }

      上述代碼描述了當螢幕小於等於960px時的樣式。若螢幕小於等於960px,其頁面背景色為黑色的。

  • /*對於iphoneX的相容*/
    -webkit-appearance:none; 
    /*height: 4em;*//*IOS中按鈕高度不會隨行高自動調整*/
    /*解決button 在android上和IOS下的相容問題顯示效果就一致了*/
    input[type=button], input[type=submit], input[type=file],input[type=checkbox],input[type=radio], button { cursor: pointer; -webkit-appearance: none; }
    -webkit-border-radius:3px;border-radius:3px;
    /*對於蘋果中input中的相容*/

  •  

     

    input::-webkit-input-placeholder{ color:red;}
    input::-moz-placeholder{ /* Mozilla Firefox 19+ */ color:red;}
    input:-moz-placeholder{ /* Mozilla Firefox 4 to 18 */ color:red;}
    input:-ms-input-placeholder{ /* Internet Explorer 10-11 */color:red;}

    /*關於表單中對 placeholder 顏色的設定*/

  • body {
    padding-top: constant(safe-area-inset-top); /*為導覽列+狀態列的高度 88px */ 
    padding-left: constant(safe-area-inset-left); /*如果未豎屏時為0*/ 
    padding-right: constant(safe-area-inset-right); /* 如果未豎屏時為0*/ 
    padding-bottom: constant(safe-area-inset-bottom); /*為底下圓弧的高度 34px*/ 
    }
    @media only screen and (width: 375px) and (height: 690px){
    body {
      background: blue;
      }
    }
    /*對於不同螢幕的媒體查詢條件的媒體查詢條件*/
  • 禁止複製、選中文本: Element { -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; user-select: none; }

    

 

 

 

 

 

關於移動端的一些相容問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.