工作了有一段时间,基本上都在搞移动端的前端开发,工作的过程中遇到过很多问题,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
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
四、 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 中的表达效果!