前端PC-移动端CSS公共样式+HTML

一:移动端公共样式

[css]  view plain  copy
  1. /* 禁用iPhone中Safari的字号自动调整 */  
  2. html {  
  3.     -webkit-text-size-adjust: 100%;  
  4.     -ms-text-size-adjust: 100%;  
  5.     /* 解决IOS默认滑动很卡的情况 */  
  6.     -webkit-overflow-scrolling : touch;  
  7. }  
  8.   
  9. /* 禁止缩放表单 */  
  10. input[type="submit"], input[type="reset"], input[type="button"], input {  
  11.     resize: none;  
  12.     bordernone;  
  13. }  
  14.   
  15. /* 取消链接高亮  */  
  16. body, div, ul, li, ol, h1, h2, h3, h4, h5, h6, input, textarea, select, p, dl, dt, dd, a, img, button, form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {  
  17.     -webkit-tap-highlight-color: rgba(0000);  
  18. }  
  19.   
  20. /* 设置HTML5元素为块 */  
  21. article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {  
  22.     displayblock;  
  23. }  
  24.   
  25. /* 图片自适应 */  
  26. img {  
  27.     width100%;  
  28.     heightauto;  
  29.     widthauto\9/* ie8 */  
  30.     displayblock;  
  31.     -ms-interpolation-mode: bicubic;/*为了照顾ie图片缩放失真*/  
  32. }  
  33.   
  34. /* 初始化 */  
  35. body, div, ul, li, ol, h1, h2, h3, h4, h5, h6, input, textarea, select, p, dl, dt, dd, a, img, button,   
  36. form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup,   
  37. menu, nav, section {  
  38.     margin0;  
  39.     padding0;  
  40. }  
  41. body {  
  42.     font12px/1.5 'Microsoft YaHei','宋体'TahomaArialsans-serif;  
  43.     color#fff;  
  44.     background-color#F7F7F7;  
  45. }  
  46. em, i {  
  47.     font-stylenormal;  
  48. }  
  49. ul,li{  
  50.     list-style-typenone;  
  51. }  
  52. strong {  
  53.     font-weightnormal;  
  54. }  
  55. table{  
  56.     border-collapse:collapse;  
  57.     border-spacing:0  
  58. }  
  59. textarea {  
  60.     resize:none/*禁用了文本的拖拉,尤其在谷歌下*/  
  61. }   
  62. p {  
  63.     word-wrap:break-word; /* 不够的单词自动换行 而不会被截掉 */  
  64. }  
  65. .clearfix:after {  
  66.     content"";  
  67.     displayblock;  
  68.     visibilityhidden;  
  69.     height0;  
  70.     clearboth;  
  71. }  
  72. .clearfix {  
  73.     zoom: 1;  
  74. }  
  75. a {  
  76.     text-decorationnone;  
  77.     color#fff;  
  78.     font-family'Microsoft YaHei'TahomaArialsans-serif;  
  79. }  
  80. a:hover {  
  81.     text-decorationnone;  
  82. }  
  83. ul, ol {  
  84.     list-stylenone;  
  85. }  
  86. h1, h2, h3, h4, h5, h6 {  
  87.     font-size100%;  
  88.     font-family'Microsoft YaHei';  
  89. }  
  90. img {  
  91.     bordernone;  
  92. }  
  93. input{  
  94.     font-family'Microsoft YaHei';  
  95. }  
  96. /*单行溢出*/  
  97. .one-txt-cut{  
  98.     overflowhidden;  
  99.     white-spacenowrap;  
  100.     text-overflow: ellipsis;  
  101. }  
  102. /*多行溢出 手机端使用*/  
  103. .txt-cut{  
  104.     overflow : hidden;  
  105.     text-overflow: ellipsis;  
  106.     display: -webkit-box;  
  107.     /* -webkit-line-clamp: 2; */  
  108.     -webkit-box-orient: vertical;  
  109. }  
  110. /* 移动端点击a链接出现蓝色背景问题解决 */  
  111. a:link,a:active,a:visited,a:hover {  
  112.     backgroundnone;  
  113.     -webkit-tap-highlight-color: rgba(0,0,0,0);  
  114.     -webkit-tap-highlight-colortransparent;  
  115. }  
  116. .overflow {overflow:hidden; }  
  117. .w50{  
  118.     width50%;  
  119. }  
  120. .w25{  
  121.     width25%;  
  122. }  
  123. .w20{  
  124.     width20%;  
  125. }  
  126. .w33{  
  127.     width33.333333%;  
  128. }  
  129. .fl{  
  130.     floatleft;  
  131. }  
  132. .fr{  
  133.     floatright;  
  134. }  
  135. .db{  
  136.     displayblock !important;  
  137. }  
  138. .dn{  
  139.     displaynone;  
  140. }  
  141.   
  142.   
  143. /* 附加 */  

二:PC端公共样式

    1.简单样式清除

[css]  view plain  copy
  1. html {width100%;-webkit-text-size-adjust:none;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;-webkit-tap-highlight-color: rgba(0000);height100%;}  
  2. body {width100%;height100%;font-size16pxcolor#fff;line-height24px;background#fff;min-height100%;font-family'Microsoft Yahei''微软雅黑'Arialsans-serif;}  
  3. * {margin0;padding0;border0;}  
  4. ul,ul li,ol,li {list-stylenone outside none;}  
  5. img {vertical-alignmiddle;bordernone;width100%;}  
  6. i {font: inherit;}  
  7. input,select,option {vertical-alignmiddle;border-radius: 0px;-moz-appearance:none;-webkit-appearance:none;appearance:none;-webkit-tap-highlight-color: rgba(0000);outlinenone;}  
  8. input[type="text"],input[type="button"],input[type="submit"],input[type="reset"] {-webkit-appearance: none;appearance: none;border-radius: 0;outlinenone;}  
  9. .fl {floatleft;displayinline;}  
  10. .fr {floatright;displayinline;}  
  11. h1,h2,h3,h4,h5,h6,i,strong {font-weightnormal;}  
  12. select::-ms-expand { displaynone; }  
  13. a {color#fff;text-decorationnone;-webkit-tap-highlight-color: rgba(0000);}  
  14. a:hover {text-decorationnone;outlinenone;}  
  15. .clear {clearboth;}  
  16. .clearfix:after {content".";displayblock;height0;clearboth;visibilityhidden;}  
  17. .clearfix {zoom: 1;displayblock;_height1px;clearboth;}  
  18. body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,dl,dt,dd,input{margin0;padding0;  

2.animate动画

        内容有点多,一般很少用,有需要留言我私发

3.ie

[html]  view plain  copy
  1. /*   
  2.  * <!--[if IE]>  
  3.  *   <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />  
  4.  * <![endif]--> */  

4.transform和一些简单面包屑

          一样  极少用,有需要我私发

三 移动端HTML

[html]  view plain  copy
  1. <html>  
  2. <head>  
  3.     <meta charset="UTF-8">  
  4.     <meta http-equiv="X-UA-Compatible" content="IE=edge">  
  5.     <!-- 关键字和描述 -->  
  6.     <meta name="keywords" content="互联网,IT开发,区块链">  
  7.     <meta name="description" content="网站是什么事没什么什么事没什么,其实没什么">  
  8.     <title>index</title>  
  9.     <meta name="viewport" content="initial-scale=1, maximum-scale=1">  
  10.     <!--收藏-->  
  11.     <!-- <link rel="shortcut icon" href="/favicon.ico"> -->  
  12.     <meta name="apple-mobile-web-app-capable" content="yes">  
  13.     <meta name="apple-mobile-web-app-status-bar-style" content="black">  
  14.     <!--微信缓存-->  
  15.     <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />  
  16.     <meta http-equiv="Pragma" content="no-cache" />  
  17.     <meta http-equiv="Expires" content="0" />  
  18.     <!-- 图标LOGO -->  
  19.     <link rel="icon" href="images/logo.ico" type="image/x-icon"/>  
  20. <span style="white-space:pre;"> </span>  
  21.     <link rel="stylesheet" href="css/comment.css"><span style="white-space:pre;"> </span>  
  22.     <!-- jS -->  
  23.     <script type="text/javascript" src="js/comment.js"></script>  
  24. </head>  
  25. <body>  
  26. <span style="white-space:pre;"> </span>  
  27. </body>  
  28. </html>  

猜你喜欢

转载自blog.csdn.net/weixin_41871290/article/details/80237660