<strike id="cy2gs"><menu id="cy2gs"></menu></strike>
  • <del id="cy2gs"><dfn id="cy2gs"></dfn></del>
  • 移動(dòng)端web頁(yè)面開發(fā)

    2018-7-26    seo達(dá)人

    如果您想訂閱本博客內(nèi)容,每天自動(dòng)發(fā)到您的郵箱中, 請(qǐng)點(diǎn)這里

     字號(hào)

    工作了有一段時(shí)間,基本上都在搞移動(dòng)端的前端開發(fā),工作的過程中遇到過很多問題,bug的解決方案,記錄下來,以便后用!!!內(nèi)容并不是很全,以后每遇到一個(gè)問題都會(huì)總結(jié)在這里,分享給大家!

    一、meta標(biāo)簽相關(guān)知識(shí)

    1、移動(dòng)端頁(yè)面設(shè)置視口寬度等于設(shè)備寬度,并禁止縮放。

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

    2、移動(dòng)端頁(yè)面設(shè)置視口寬度等于定寬(如640px),并禁止縮放,常用于微信瀏覽器頁(yè)面。

    <meta name="viewport" content="width=640,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />

    3、禁止將頁(yè)面中的數(shù)字識(shí)別為電話號(hào)碼

    <meta name="format-detection" content="telephone=no" />

    4、忽略Android平臺(tái)中對(duì)郵箱地址的識(shí)別

    <meta name="format-detection" content="email=no" />

    5、當(dāng)網(wǎng)站添加到主屏幕快速啟動(dòng)方式,可隱藏地址欄,僅針對(duì)ios的safari

    
        
    1. <meta name="apple-mobile-web-app-capable" content="yes" />
    2. <!-- ios7.0版本以后,safari上已看不到效果 -->

    6、將網(wǎng)站添加到主屏幕快速啟動(dòng)方式,僅針對(duì)ios的safari頂端狀態(tài)條的樣式

    
        
    1. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    2. <!-- 可選default、black、black-translucent -->

    viewport模板

    
        
    1. <!DOCTYPE html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
    6. <meta content="yes" name="apple-mobile-web-app-capable">
    7. <meta content="black" name="apple-mobile-web-app-status-bar-style">
    8. <meta content="telephone=no" name="format-detection">
    9. <meta content="email=no" name="format-detection">
    10. <title>title</title>
    11. <link rel="stylesheet" href="index.css">
    12. </head>
    13. <body>
    14. content...
    15. </body>
    16. </html>

    二、CSS樣式技巧

    1、禁止ios和android用戶選中文字

    .css{-webkit-user-select:none}

    2、禁止ios長(zhǎng)按時(shí)觸發(fā)系統(tǒng)的菜單,禁止ios&android長(zhǎng)按時(shí)下載圖片

    .css{-webkit-touch-callout: none}

    3、webkit去除表單元素的默認(rèn)樣式

    .css{-webkit-appearance:none;}

    4、修改webkit表單輸入框placeholder的樣式

    
        
    1. input::-webkit-input-placeholder{color:#AAAAAA;}
    2. input:focus::-webkit-input-placeholder{color:#EEEEEE;}

    5、去除android a/button/input標(biāo)簽被點(diǎn)擊時(shí)產(chǎn)生的邊框 & 去除ios a標(biāo)簽被點(diǎn)擊時(shí)產(chǎn)生的半透明灰色背景

    a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0);}

    6、ios使用-webkit-text-size-adjust禁止調(diào)整字體大小

    body{-webkit-text-size-adjust: 100%!important;}

    7、android 上去掉語(yǔ)音輸入按鈕

    input::-webkit-input-speech-button {display: none}

    8、移動(dòng)端定義字體,移動(dòng)端沒有微軟雅黑字體

    
        
    1. /* 移動(dòng)端定義字體的代碼 */
    2. body{font-family:Helvetica;}

    三、其他技巧

    1、手機(jī)拍照和上傳圖片

    
        
    1. <!-- 選擇照片 -->
    2. <input type=file accept="image/*">
    3. <!-- 選擇視頻 -->
    4. <input type=file accept="video/*">

    2、取消input在ios下,輸入的時(shí)候英文首字母的默認(rèn)大寫

    <input autocapitalize="off" autocorrect="off" />

    3、打電話和發(fā)短信

    
        
    1. <a href="tel:0755-10086">打電話給:0755-10086</a>
    2. <a href="sms:10086">發(fā)短信給: 10086</a>

    四、CSS reset

    
        
    1. /* hcysun */
    2. @charset "utf-8";
    3. /* reset */
    4. html{
    5. -webkit-text-size-adjust:none;
    6. -webkit-user-select:none;
    7. -webkit-touch-callout: none
    8. font-family: Helvetica;
    9. }
    10. body{font-size:12px;}
    11. body,h1,h2,h3,h4,h5,h6,p,dl,dd,ul,ol,pre,form,input,textarea,th,td,select{margin:0; padding:0; font-weight: normal;text-indent: 0;}
    12. a,button,input,textarea,select{ background: none; -webkit-tap-highlight-color:rgba(255,0,0,0); outline:none; -webkit-appearance:none;}
    13. em{font-style:normal}
    14. li{list-style:none}
    15. a{text-decoration:none;}
    16. img{border:none; vertical-align:top;}
    17. table{border-collapse:collapse;}
    18. textarea{ resize:none; overflow:auto;}
    19. /* end reset */

    五、常用公用CSS style

    
        
    1. /* public */
    2. /* 清除浮動(dòng) */
    3. .clear { zoom:1; }
    4. .clear:after { content:''; display:block; clear:both; }
    5. /* 定義盒模型為怪異和模型(寬高不受邊框影響) */
    6. .boxSiz{
    7. -webkit-box-sizing: border-box;
    8. -moz-box-sizing: border-box;
    9. -ms-box-sizing: border-box;
    10. -o-box-sizing: border-box;
    11. box-sizing: border-box;
    12. }
    13. /* 強(qiáng)制換行 */
    14. .toWrap{
    15. word-break: break-all; /* 只對(duì)英文起作用,以字母作為換行依據(jù)。 */
    16. word-wrap: break-word; /* 只對(duì)英文起作用,以單詞作為換行依據(jù)。*/
    17. white-space: pre-wrap; /* 只對(duì)中文起作用,強(qiáng)制換行。*/
    18. }
    19. /* 禁止換行 */
    20. .noWrap{
    21. white-space:nowrap;
    22. }
    23. /* 禁止換行,超出省略號(hào) */
    24. .noWrapEllipsis{
    25. white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    26. }
    27. /* 文字兩端對(duì)齊 */
    28. .text-justify{
    29. text-align:justify;
    30. text-justify:inter-ideograph;
    31. }
    32. /* 定義盒模型為 flex布局兼容寫法并讓內(nèi)容水平垂直居中 */
    33. .flex-center{
    34. display: -webkit-box;
    35. display: -moz-box;
    36. display: -ms-flexbox;
    37. display: -o-box;
    38. display: box;
    39. -webkit-box-pack: center;
    40. -moz-box-pack: center;
    41. -ms-flex-pack: center;
    42. -o-box-pack: center;
    43. box-pack: center;
    44. -webkit-box-align: center;
    45. -moz-box-align: center;
    46. -ms-flex-align: center;
    47. -o-box-align: center;
    48. box-align: center;
    49. }
    50. /* public end */

    六、flex布局

    1、定義彈性盒模型兼容寫法

    
        
    1. /*
    2. box
    3. inline-box
    4. */
    5. display: -webkit-box;
    6. display: -moz-box;
    7. display: -ms-flexbox;
    8. display: -o-box;
    9. display: box;

    2、box-orient 定義盒模型內(nèi)伸縮項(xiàng)目的布局方向

    
        
    1. /**
    2. * vertical column 垂直
    3. * horizontal row 水平 默認(rèn)值
    4. */
    5. -webkit-box-orient: horizontal;
    6. -moz-box-orient: horizontal;
    7. -ms-flex-direction: row;
    8. -o-box-orient: horizontal;
    9. box-orient: horizontal;

    3、box-direction 定義盒模型內(nèi)伸縮項(xiàng)目的正序(normal默認(rèn)值)、倒敘(reverse)

    
        
    1. /* Firefox */
    2. display:-moz-box;
    3. -moz-box-direction:reverse;
    4. /* Safari、Opera 以及 Chrome */
    5. display:-webkit-box;
    6. -webkit-box-direction:reverse;

    4、box-pack 對(duì)盒子水平富裕空間的管理

    
        
    1. /*
    2. start
    3. end
    4. center
    5. justify
    6. */
    7. -webkit-box-pack: center;
    8. -moz-box-pack: center;
    9. -ms-flex-pack: center;
    10. -o-box-pack: center;
    11. box-pack: center;

    5、box-pack 對(duì)盒子垂直方向富裕空間的管理

    
        
    1. /*
    2. start
    3. end
    4. center
    5. */
    6. /* box-align */
    7. -webkit-box-align: center;
    8. -moz-box-align: center;
    9. -ms-flex-align: center;
    10. -o-box-align: center;
    11. box-align: center;

    6、定義伸縮項(xiàng)目的具體位置

    
        
    1. /*-moz-box-ordinal-group:1;*/ /* Firefox */
    2. /*-webkit-box-ordinal-group:1;*/ /* Safari 和 Chrome */
    3. .box div:nth-of-type(1){-webkit-box-ordinal-group:1;}
    4. .box div:nth-of-type(2){-webkit-box-ordinal-group:2;}
    5. .box div:nth-of-type(3){-webkit-box-ordinal-group:3;}
    6. .box div:nth-of-type(4){-webkit-box-ordinal-group:4;}
    7. .box div:nth-of-type(5){-webkit-box-ordinal-group:5;}

    7、定義伸縮項(xiàng)目占空間的份數(shù)

    
        
    1. -moz-box-flex:2.0; /* Firefox */
    2. -webkit-box-flex:2.0; /* Safari 和 Chrome */
    3. .box div:nth-of-type(1){-webkit-box-flex:1;}
    4. .box div:nth-of-type(2){-webkit-box-flex:2;}
    5. .box div:nth-of-type(3){-webkit-box-flex:3;}
    6. .box div:nth-of-type(4){-webkit-box-flex:4;}
    7. .box div:nth-of-type(5){-webkit-box-flex:5;}

    藍(lán)藍(lán)設(shè)計(jì)www.skdbbs.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)

    日歷

    鏈接

    個(gè)人資料

    存檔

    主站蜘蛛池模板: 日韩人妻无码精品无码中文字幕| 亚洲国产精品成人久久| 日本精品一区二区三区在线视频| 97r久久精品国产99国产精| 精品国产91久久久久久久a| 欧美黑人巨大精品| 成人国产精品免费视频| 日韩精品一区二三区中文 | 亚洲精品网站在线观看不卡无广告 | 国产精品igao视频| 国产精品久久久久久| 日韩人妻精品一区二区三区视频| 日韩精品成人亚洲专区| 欧美黑人巨大videos精品| 国内精品久久久久国产盗摄 | www.99精品| 国产99视频精品免视看7| 精品久久人妻av中文字幕| 无码日韩精品一区二区三区免费 | 亚洲国产成人久久精品动漫| 国产精品岛国久久久久| 97精品久久天干天天天按摩 | 久久久免费精品re6| 亚洲欧洲成人精品香蕉网| 亚洲国产精品狼友中文久久久| 久久久精品波多野结衣| 国产色婷婷精品综合在线| 国产亚洲精品a在线观看| 国产乱人伦偷精品视频| 国产玖玖玖九九精品视频| 久久91精品综合国产首页| 久久久久99精品成人片| 青青热久久国产久精品 | 亚洲国产精品福利片在线观看| 无码人妻精品中文字幕免费 | 日韩福利视频精品专区| 夜夜爽一区二区三区精品| 亚洲欧美日韩另类精品一区二区三区| 在线精品亚洲一区二区小说| 亚洲精品高清国产一线久久| 久久精品夜夜夜夜夜久久|