码迷,mamicode.com
首页 > 其他好文 > 详细

前端笔记

时间:2017-09-23 21:26:27      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:idt   otto   表达式   mail   垂直居中   doc   exp   png   www   

1.强制文字换行

word-wrap: break-word;word-break: break-all;

2、opcity兼容ie方法
filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity: 0;opacity: 0;

3.ie6/7overflow:hidden不起作用   加*position:relative

4.max-width,min-width兼容ie6/7
min-width:25px;max-width: 140px;padding:0 8px;
*+min-width: auto; 
*+width: expression(this.offsetWidth > 25 ? (this.offsetWidth < 140 ? ‘auto‘ : ‘140px‘) : ‘25px‘); 
_width: expression(this.offsetWidth > 25 ? (this.offsetWidth < 140 ? ‘auto‘ : ‘140px‘) : ‘25px‘);overflow: hidden;

.integral-information-td{height: 45px;padding: 10px;max-width: 220px;border-bottom: 1px solid #dcdcdc;border-right: 1px solid #dcdcdc;
color: #333333; text-align: center; *+min-width: auto; 
*+width: expression(this.offsetWidth > 100 ? (this.offsetWidth < 220 ? ‘auto‘ : ‘220px‘) : ‘100px‘); 
_width: expression(this.offsetWidth > 100 ? (this.offsetWidth < 220 ? ‘auto‘ : ‘220px‘) : ‘100px‘);overflow: hidden;}

5.ie低版本中的虚线框去除 a {star : expression(this.onFocus=this.blur());}

6.ios去除灰input文本框边框

-webkit-appearance:none;注:moz无灰边框

7.设置ios safari浏览器不自动识别电话号码和邮箱

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

8、去除display:inline-block空格:font-size:0;letter-spacing:-0.307em;*letter-spacing:normal;*word-spacing:-1px;

9、弹性盒模型布局
.box{ width:XXX;display: -webkit-box;display: -moz-box;display: -ms-flexbox;display: -webkit-flex;display: flex;}
.list{ -webkit-box-flex: 1; -moz-box-flex: 1; -webkit-flex: 1;-ms-flex: 1;flex: 1;}

10、css禁止网页文字选中
-moz-user-select:none;/*火狐*/
-webkit-user-select:none;/*webkit浏览器*/
-ms-user-select:none;/*IE10*/
-khtml-user-select:none;/*早期浏览器*/
user-select:none;

11、去除input select默认样式
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
-webkit-appearance: none; 
appearance: none; 
margin: 0; 
}

12.动画延时3s执行

animation-delay: 3s;animation-fill-mode:both;

16.解决移动端1px border

1)<span class="guess-button">看相似</span>
.guess-button:after{
content: ‘‘;
width: 200%;
height: 200%;
position: absolute;
top: 0;
left: 0;
border: 1px solid #bfbfbf;
border-radius: 4px;
-webkit-transform: scale(0.5, 0.5);
transform: scale(0.5, 0.5);
-webkit-transform-origin: top left;
}

2)上下左右只有一个border用padding:1px;backckground:red;

3)上下左右只有一个border:

.line{width:100%;height:1px;background:red;}

<div class="line"></div>

17.css实现居中:
1).table-cell
<div class="box box1">
  <span>垂直居中</span>
</div>

.box1{
   display: table-cell;
   vertical-align: middle;
   text-align: center;
}

2).兼容ie低版本写法

<div class="titlebox">
  <span class="mtitlebox">
    <i>移动自有</i>
  </span>
</div>

.titlebox{display: table;overflow: hidden;*position: relative;width:34px;height:28px;*display:block;}
.titlebox .mtitlebox{vertical-align: middle;display: table-cell;*display:block;*position: absolute; *top: 50%;*left: 0;width:100%;}
.titlebox .mtitlebox i{display:block;*position: relative;*top: -50%;width:100%;cursor: pointer;}

18.ie低版本支持媒体查询方法

引入文件respond.src-min.js,注意:该方法只有在静态页面中无效,必须起服务

19.ie6支持png格式图片

<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG.js"></script>
<script type="text/javascript">
  DD_belatedPNG.fix(‘.tel,.head_content‘);
</script>

13.doctype 声明网页按照w3c解析盒模型:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

14.数组取最大值最小值:

var a=[1,2,3,5];
alert(Math.max.apply(null, a));//最大值
alert(Math.min.apply(null, a));//最小值
多维数组取最大值最小值:
var a=[1,2,3,[5,6],[1,4,8]];
var ta=a.join(",").split(",");//转化为一维数组
alert(Math.max.apply(null,ta));//最大值
alert(Math.min.apply(null,ta));//最小值
(数组常用方法:http://www.cnblogs.com/codetker/p/4676899.html)

15.常用的正则表达式

<input type="number" pattern="\d">
<input type="number" pattern="[0-9]*">

pattern的用法都一样,这里不再啰嗦各种详细写法了,只是列出来一些常用的正则就好了:
信用卡 [0-9]{13,16}
银联卡 ^62[0-5]\d{13,16}$
Visa: ^4[0-9]{12}(?:[0-9]{3})?$
万事达:^5[1-5][0-9]{14}$
QQ号码: [1-9][0-9]{4,14}
手机号码:^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
身份证:^([0-9]){7,18}(x|X)?$
密码:^[a-zA-Z]\w{5,17}$ 字母开头,长度在6~18之间,只能包含字母、数字和下划线
强密码:^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$ 包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间
7个汉字或14个字符:^[\u4e00-\u9fa5]{1,7}$|^[\dA-Za-z_]{1,14}$

 

前端笔记

标签:idt   otto   表达式   mail   垂直居中   doc   exp   png   www   

原文地址:http://www.cnblogs.com/ffyyy/p/7582316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!