工作了有一段時間,基本上都在搞移動端的前端開發,工作的過程中遇到過很多問題,bug 的解決方案,記錄下來,以便後用!!!內容並不是很全,以後每遇到一個問題都會總結在這裏,WordPress 網站建設分享給大家!

一、 meta 標籤相關知識

1 、移動端頁面設定視口寬度等於裝置寬度,並禁止縮放。

1

2 、移動端頁面設定視口寬度等於定寬(如 640px),並禁止縮放,常用於 WordPress 微信瀏覽器頁面。

1

3 、禁止將頁面中的數字識別為電話號碼

1

4 、忽略 Android 平台中對郵箱地址的識別

1

5 、當網站新增到主螢幕快速啓動方式,可隱藏位址列,僅針對 ios 的 safari

1

2

6 、將網站新增到主螢幕快速啓動方式,僅針對 ios 的 safari 頂端狀態條的樣式

1

2

viewport 模板

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

title

 

    content…

 

 

二、 CSS 樣式技巧

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

1

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

2 、禁止 ios 長按時觸發系統的選單,禁止 ios&android 長按時下載圖片

1

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

3 、 webkit 去除表單元素的預設樣式

1

.css{-webkit-WordPress APPearance:none;}

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

1

2

input::-webkit-input-placeholder{color:#AAAAAA;}

input:focus::-webkit-input-placeholder{color:#EEEEEE;}

5 、去除 android a/button/input 標籤被點選時產生的邊框 & 去除 ios a 標籤被點選時產生的半透明灰色背景

1

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

6 、 ios 使用-webkit-text-size-adjust 禁止調整字型大小

1

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

7 、 android 上去掉語音輸入按鈕

1

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

8 、移動端定義字型,移動端沒有微軟雅黑字型

1

2

/* 移動端定義字型的代碼 */

body{font-family:Helvetica;}

三、其他技巧

1 、手機拍照和上傳圖片

1

2

3

4

2 、取消 input 在 ios 下,輸入的時候英文字母的預設大寫

1

3 、打電話和發簡訊

1

2

打電話給:0755-10086

發簡訊給: 10086

四、 CSS reset

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

/* hcysun  */

@charset “utf-8″;

/* reset */

html{

    -webkit-text-size-adjust:none;

    -webkit-user-select:none;

    -webkit-touch-callout: none

    font-family: Helvetica;

}

body{font-size:12px;}

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;}

a,button,input,textarea,select{ background: none; -webkit-tap-highlight-color:rgba(255,0,0,0); outline:none; -webkit-WordPress APPearance:none;}

em{font-style:normal}

li{list-style:none}

a{text-decoration:none;}

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

table{border-collapse:collapse;}

textarea{ resize:none; overflow:auto;}

/* end reset */

五、常用公用 CSS style

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

/* public */

 

/* 清除浮動 */

.clear { zoom:1; }

.clear:after { content:”; display:block; clear:both; }

 

/* 定義盒模型為怪異和模型(寬高不受邊框影響)*/

.boxSiz{

    -webkit-box-sizing: border-box;

    -moz-box-sizing: border-box;

    -ms-box-sizing: border-box;

    -o-box-sizing: border-box;

    box-sizing: border-box;

}

 

/* 強制換行 */

.toWrap{

    word-break: break-all;       /* 只對英文起作用,以字母作為換行依據。 */

    word-wrap: break-word;       /* 只對英文起作用,以單詞作為換行依據。*/

    white-space: pre-wrap;     /* 只對中文起作用,強制換行。*/

}

 

/* 禁止換行 */

.noWrap{

    white-space:nowrap;

}

 

/* 禁止換行, 超出省略號 */

.noWrapEllipsis{

     white-space:nowrap; overflow:hidden; text-overflow:ellipsis;

}

 

/* 文字兩端對齊 */

.text-justify{

    text-align:justify;

    text-justify:inter-ideograph;

}

 

/* 定義盒模型為 flex 佈局相容寫法並讓內容水平垂直居中 */

.flex-center{

    display: -webkit-box;

    display: -moz-box;

    display: -ms-flexbox;

    display: -o-box;

    display: box;

 

    -webkit-box-pack: center;

    -moz-box-pack: center;

    -ms-flex-pack: center;

    -o-box-pack: center;

    box-pack: center;

 

    -webkit-box-align: center;

    -moz-box-align: center;

    -ms-flex-align: center;

    -o-box-align: center;

    box-align: center;

}

 

/* public end */

六、 flex 佈局

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

1

2

3

4

5

6

7

8

9

/*

    box

    inline-box

*/

display: -webkit-box;

display: -moz-box;

display: -ms-flexbox;

display: -o-box;

display: box;

2 、 box-orient 定義盒模型內伸縮專案的佈局方向

1

2

3

4

5

6

7

8

9

/**

* vertical column    垂直

* horizontal row    水平 預設值

*/

-webkit-box-orient: horizontal;

-moz-box-orient: horizontal;

-ms-flex-direction: row;

-o-box-orient: horizontal;

box-orient: horizontal;

3 、 box-direction 定義盒模型內伸縮專案的正序 (normal 預設值) 、倒敍 (reverse)

1

2

3

4

5

6

/* Firefox */

display:-moz-box;

-moz-box-direction:reverse;

/* Safari 、 Opera 以及 Chrome */

display:-webkit-box;

-webkit-box-direction:reverse;

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

1

2

3

4

5

6

7

8

9

10

11

/*

    start

    end

    center

    justify

*/

-webkit-box-pack: center;

-moz-box-pack: center;

-ms-flex-pack: center;

-o-box-pack: center;

box-pack: center;

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

1

2

3

4

5

6

7

8

9

10

11

/*

    start

    end

    center

*/

/* box-align */

-webkit-box-align: center;

-moz-box-align: center;

-ms-flex-align: center;

-o-box-align: center;

box-align: center;

6 、定義伸縮專案的具體位置

1

2

3

4

5

6

7

/*-moz-box-ordinal-group:1;*/ /* Firefox */

/*-webkit-box-ordinal-group:1;*/ /* Safari 和 Chrome */

.box div:nth-of-type(1){-webkit-box-ordinal-group:1;}

.box div:nth-of-type(2){-webkit-box-ordinal-group:2;}

.box div:nth-of-type(3){-webkit-box-ordinal-group:3;}

.box div:nth-of-type(4){-webkit-box-ordinal-group:4;}

.box div:nth-of-type(5){-webkit-box-ordinal-group:5;}

7 、定義伸縮專案佔空間的份數

1

2

3

4

5

6

7

8

-moz-box-flex:2.0; /* Firefox */

-webkit-box-flex:2.0; /* Safari 和 Chrome */

 

.box div:nth-of-type(1){-webkit-box-flex:1;}

.box div:nth-of-type(2){-webkit-box-flex:2;}

.box div:nth-of-type(3){-webkit-box-flex:3;}

.box div:nth-of-type(4){-webkit-box-flex:4;}

.box div:nth-of-type(5){-webkit-box-flex:5;}

其實對於網站建設行業來講,先進的技術水平是本行業的致命要素,如果您沒有的技術水平,不能滿足客户的需求,那為什麼客户還來找您建網站,您的優勢又在哪裏?這也是一些小的網站建設公司所存在的矛盾,技術水平不達標,單子不能籤,人員的成本過高,簽單的金額又不能滿足平時的盈利開銷。這是目前 WordPress 網站建設公司所存在的普遍問題,而我們 WordPress 網站建設-沙漠風就不存在這樣的問題,公司技術團隊達到 50 多人,是目前 WordPress 網站建設公司中僅有的人員配置!而就目前的手機端網站建設來講我們也不再話下,很多的技術都能夠勝任,今天小編就來分享一下大家常用的 h5 中的表達效果!