工作了有一段時(shí)間,基本上都在搞移動(dòng)端的前端開發(fā),工作的過程中遇到過很多問題,bug的解決方案,記錄下來,以便后用!!!內(nèi)容并不是很全,以后每遇到一個(gè)問題都會(huì)總結(jié)在這里,佛山網(wǎng)站建設(shè)分享給大家!
1、移動(dòng)端頁(yè)面設(shè)置視口寬度等于設(shè)備寬度,并禁止縮放。
1
|
<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è)面。
1
|
<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)碼
1
|
<meta name="format-detection" content="telephone=no" />
|
4、忽略Android平臺(tái)中對(duì)郵箱地址的識(shí)別
1
|
<meta name="format-detection" content="email=no" />
|
5、當(dāng)網(wǎng)站添加到主屏幕快速啟動(dòng)方式,可隱藏地址欄,僅針對(duì)ios的safari
1
2
|
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- ios7.0版本以后,safari上已看不到效果 -->
|
6、將網(wǎng)站添加到主屏幕快速啟動(dòng)方式,僅針對(duì)ios的safari頂端狀態(tài)條的樣式
1
2
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- 可選default、black、black-translucent -->
|
viewport模板
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<title>title</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
content...
</body>
</html>
|
二、CSS樣式技巧
1、禁止ios和android用戶選中文字
1
|
.css{-webkit-user-select:none}
|
2、禁止ios長(zhǎng)按時(shí)觸發(fā)系統(tǒng)的菜單,禁止ios&android長(zhǎng)按時(shí)下載圖片
1
|
.css{-webkit-touch-callout: none}
|
3、webkit去除表單元素的默認(rèn)樣式
1
|
.css{-webkit-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標(biāo)簽被點(diǎn)擊時(shí)產(chǎn)生的邊框 & 去除ios a標(biāo)簽被點(diǎn)擊時(shí)產(chǎn)生的半透明灰色背景
1
|
a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0);}
|
6、ios使用-webkit-text-size-adjust禁止調(diào)整字體大小
1
|
body{-webkit-text-size-adjust: 100%!important;}
|
7、android 上去掉語(yǔ)音輸入按鈕
1
|
input::-webkit-input-speech-button {display: none}
|
8、移動(dòng)端定義字體,移動(dòng)端沒有微軟雅黑字體
1
2
|
/* 移動(dòng)端定義字體的代碼 */
body{font-family:Helvetica;}
|
三、其他技巧
1、手機(jī)拍照和上傳圖片
1
2
3
4
|
<!-- 選擇照片 -->
<input type=file accept="image/*">
<!-- 選擇視頻 -->
<input type=file accept="video/*">
|
2、取消input在ios下,輸入的時(shí)候英文字母的默認(rèn)大寫
1
|
<input autocapitalize="off" autocorrect="off" />
|
3、打電話和發(fā)短信
1
2
|
<a href="tel:0755-10086">打電話給:0755-10086</a>
<a href="sms:10086">發(fā)短信給: 10086</a>
|
四、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-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 */
/* 清除浮動(dòng) */
.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;
}
/* 強(qiáng)制換行 */
.toWrap{
word-break: break-all; /* 只對(duì)英文起作用,以字母作為換行依據(jù)。 */
word-wrap: break-word; /* 只對(duì)英文起作用,以單詞作為換行依據(jù)。*/
white-space: pre-wrap; /* 只對(duì)中文起作用,強(qiáng)制換行。*/
}
/* 禁止換行 */
.noWrap{
white-space:nowrap;
}
/* 禁止換行,超出省略號(hào) */
.noWrapEllipsis{
white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
/* 文字兩端對(duì)齊 */
.text-justify{
text-align:justify;
text-justify:inter-ideograph;
}
/* 定義盒模型為 flex布局兼容寫法并讓內(nèi)容水平垂直居中 */
.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 定義盒模型內(nèi)伸縮項(xiàng)目的布局方向
1
2
3
4
5
6
7
8
9
|
/**
* vertical column 垂直
* horizontal row 水平 默認(rèn)值
*/
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-ms-flex-direction: row;
-o-box-orient: horizontal;
box-orient: horizontal;
|
3、box-direction 定義盒模型內(nèi)伸縮項(xiàng)目的正序(normal默認(rèn)值)、倒敘(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 對(duì)盒子水平富裕空間的管理
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 對(duì)盒子垂直方向富裕空間的管理
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、定義伸縮項(xiàng)目的具體位置
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、定義伸縮項(xiàng)目占空間的份數(shù)
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;}
其實(shí)對(duì)于網(wǎng)站建設(shè)行業(yè)來講,先進(jìn)的技術(shù)水平是本行業(yè)的致命要素,如果你沒有的技術(shù)水平,不能滿足客戶的需求,那為什么客戶還來找你建網(wǎng)站,你的優(yōu)勢(shì)又在哪里?這也是一些小的網(wǎng)站建設(shè)公司所存在的矛盾,技術(shù)水平不達(dá)標(biāo),單子不能簽,人員的成本過高,簽單的金額又不能滿足平時(shí)的盈利開銷。這是目前佛山網(wǎng)站建設(shè)公司所存在的普遍問題,而我們佛山網(wǎng)站建設(shè)-零度網(wǎng)絡(luò)就不存在這樣的問題,公司技術(shù)團(tuán)隊(duì)達(dá)到50多人,是目前佛山網(wǎng)站建設(shè)公司中僅有的人員配置!而就目前的手機(jī)端網(wǎng)站建設(shè)來講我們也不再話下,很多的技術(shù)都能夠勝任,今天小編就來分享一下大家常用的h5中的表達(dá)效果!
|
網(wǎng)頁(yè)設(shè)計(jì)
企業(yè)網(wǎng)站建設(shè)一條龍
找零度飛易網(wǎng)絡(luò)公司-fslingdu所做php
網(wǎng)站建設(shè)方案、
網(wǎng)站設(shè)計(jì)、
網(wǎng)站制作由
北京上海深圳龍崗衢州蘭州常州東營(yíng)南通濟(jì)寧桂林淮安煙臺(tái)長(zhǎng)春無錫天津昆山蘇州合肥貴洛陽(yáng)昆明天津唐山泉州惠州萬州新鄉(xiāng)商丘臺(tái)州哈爾濱太原攝影海口隨州學(xué)校商丘廣東湖南廣西江西海南廣州企業(yè)中小企業(yè)武漢南山羅湖福田虎門肇慶汕尾汕頭廣州佛山成都杭州濟(jì)南重慶福州西安廈門昆山沈陽(yáng)青島徐州鄭州南京寧南寧長(zhǎng)沙大連淄博石家莊南昌溫州珠海番禺順德南三水高明中山東莞合肥江門嘉興西寧大良容桂倫教勒流陳村均安杏壇龍江樂從北滘祖廟石灣南莊等地區(qū)
企業(yè)網(wǎng)站建設(shè)(廣告)公司提供專業(yè)做網(wǎng)站價(jià)格規(guī)劃書及
營(yíng)銷型網(wǎng)站制作,
網(wǎng)站建設(shè)基礎(chǔ)知識(shí)