1.解决边框问题,内边距和边框在设定商务高宽内部
box-sizing:border-box;
2.移动端模拟1px的边框
box-shadow:0 0 0 1px #ddd;
3.~~双波浪线取整
var str="123.123";
console.log(~~str); //123
4.垂直居中的思路
- 绝对定位(固定宽高)
- 绝对定位(不固定宽高)
transform:translate(-50%,-50%);
- 水平居中,垂直居中
- 变成表格
display:table-cell;
5.ajax跨域
xhrFields:{withCredentials:true}
crossDomain:true
6.width
前者最大为图片的大小,后者根据父元素自适应
max-width:100%;
width:100%;
7.文字溢出
width:300px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis; //溢出部分为省略号
8.li中 inline-block出现40px的空隙
ul{font-size:0;}
9.满屏
<script type="text/javascript" src="fullpage.js"></script>
10.绑定事件
- on 单个事件
- addEventListener 多个事件
11.jq取值,赋值
$("").attr(""); //取值
$("").attr("",""); //赋值
12.权重
- !important 最高权重
13.严格模式
use strict