PC端和移動端網頁的初始化樣式

來源:互聯網
上載者:User

標籤:pc端 移動端 網頁 初始化樣式

pc端樣式重設

 

*{ margin:0; padding:0;}

body{ font-size:14px; font-family:微軟雅黑;font-style:normal;}

a{ text-decoration:none}

a,a:hover{  transition:background 0.5s linear;-webkit-transition:background 0.5s linear;-moz-transition:background 0.5s linear;-o-transition:background 0.5s linear;}

em, i{font-style: normal;}

ul, ol, li{list-style: none;}

img{ border:none;vertical-align:middle;}

input,select,textarea{outline:none;border:none;background:none;}

textarea{resize:none;}

p{line-height:22px;}

.fl{float: left;}

.fr{float: right;}

.clear{ clear:both; height:0px; width:100%; overflow:hidden;}

.position{position:relative;}

 

/*公用樣式*/

.layout{ width:1100px; display:table; margin:0 auto;}

 

/*頭部*/

 

/*導航*/

 

/*banner*/

 

/*內容*/

 

/*底部*/

 

 

 

/******************************************************************************/

 

移動端頁面注意事項:

 

1.移動端樣式重設

 

/* CSS Document */

*{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;font-family:Arial, "微軟雅黑";}

img{border:none;max-width:100%;vertical-align:middle;}

body,p,form,input,button,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6{margin:0;padding:0;list-style:none;overflow-x:hidden}

h1,h2,h3,h4,h5,h6{font-size:100%;}

input,textarea{-webkit-user-select:text;-ms-user-select:text;user-select:text;-webkit-appearance:none;font-size:1em;line-height:1.5em;}

table{border-collapse:collapse;}

input,select,textarea{outline:none;border:none;background:none;}

a{outline:0;cursor:pointer;*star:expression(this.onbanner=this.blur());}

a:link,a:active{text-decoration:none;}

a:visited{text-decoration:none;}

a:hover{color:#f00;text-decoration:underline;}

a{text-decoration:none;-webkit-touch-callout:none;}

em,i{font-style:normal;}

li,ol{list-style:none;}

html{font-size:10px;}

.clear{clear:both;height:0;font-size:0;line-height:0;visibility:hidden; overflow:hidden;} 

.fl{float:left;}

.fr{float:right;}

body{ margin:0 auto;max-width:640px; min-width:320px;color:#555; padding-bottom:8%;background:#fef9f1;height:100%;}

 

 

底部

@media screen and (max-width:320px){body,input,select{font-size:10px}}

@media screen and (min-width:320px){body,input,select{font-size:11.25px}}

@media screen and (min-width:400px){body,input,select{font-size:12.5px}}

@media screen and (min-width:480px){body,input,select{font-size:13.75px}}

@media screen and (min-width:560px){body,input,select{font-size:15px}}

@media screen and (min-width:600px){body,input,select{font-size:16.25px}}

@media screen and (min-width:640px){body,input,select{font-size:18px}}

 

 

2.在HTML源檔案中的頭部head加入:<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes">

 


PC端和移動端網頁的初始化樣式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.