tip

1.line-height未生效, 文字的居中对齐方式 改vertical-align: center 让基线在同一水平线上;

2.Alt+J, WebStorm选中相同的

3. hidden-sm 隐藏

4.+号选择器 可以应用于设置左边框,不选中第1个元素

5.css3的background-size属性 值为contain时父元素包含整个元素,等比缩放 值为cover时等比缩放至占满父元素

6.window.innerWidth获取窗口大小  兼容写法 window.documentElement.clientWidth   怪异浏览器下window.body.clientWitdth  jquery写法$(window).width()

if(window.innerWidth != null){
return { window.innerWidth}; ie9+及最新
}
else if(document.compatMode == "CSS1Compat"){
return {window.documentElement.clientWidth};标准浏览器

}
else {
return {window.body.clientWitdth};怪异浏览器
}

7.p:nth-child(3)和p:nth-of-type(3)的区别

child 1.父元素下的第3个元素 2.元素为p标签   type:父元素下的第3个p元素

8.$.each(array,function(index,element) {})   array.each(function(index,element) {})  element为dom对象 需要转换为jquery对象

9.jquery取data属性 $item.data('image-xs')

10.要让图片水平居中 1.设置为背景图片 background-position:center center   2.设置为绝对定位 left:50%,margin-left:-width/2;

11.行内式写法<div class="item active" style="background:url(images/slide_01_2000x410.jpg) no-repeat center center;1000px ">

12..css()设置css样式  .attr()设置属性      $ele.attr("backgroundImage","url('"+data+"')"); //错误

13.尾部9个合作伙伴宽度自适应: 设置li的cacl(100%/9) text-align:center








原文地址:https://www.cnblogs.com/zmshare/p/6075801.html