20180426前端笔记

CSS相关:

一 如何实现水平、竖直居中布局:

内联元素居中:

1.文本等行内元素:
设置text-align: center;
2.Flex布局
设置display:flex;
justify-content:center;(灵活运用,支持Chroime,Firefox,IE9+)

垂直居中设置:
1.父元素高度确定的单行文本(内联元素)
设置 height = line-height;
2.父元素高度确定的多行文本(内联元素)
a:插入 table (插入方法和水平居中一样),然后设置 vertical-align:middle;
b:先设置 display:table-cell 再设置 vertical-align:middle;

块级元素居中方案

水平居中设置:
1.定宽块状元素
设置 左右 margin 值为 auto;

2.不定宽块状元素
a:在元素外加入 table 标签(完整的,包括 table、tbody、tr、td),该元素写在 td 内,然后设置 margin 的值为 auto;
b:给该元素设置 display:inine 方法;

垂直居中设置:
使用position:absolute(fixed),设置left、top、margin-left、margin-top的属性;
利用position:fixed(absolute)属性,margin:auto这个必须不要忘记了;
利用display:table-cell属性使内容垂直居中;
使用css3的新属性transform:translate(x,y)属性;
使用:before元素;

2. 清除浮动.clearfix如何定义

.clearfix:after {
    content:".";
    display:block;
    height:0;
    visibility:hidden;
    clear:both;
}
  1. sass

JS相关:

一 原型链:原型,构造函数,实例之间的关系

构造函数和实例

function Person(name, age, job) {
 this.name = name;
 this.age = age;
 this.job = job;
 this.sayName = function() { alert(this.name) } 
}
var person1 = new Person('Alisa', 24, 'Engineer');
var person2 = new Person('Lily', 25, 'Doctor');

person1 和 person2 是构造函数 Person 的实例
实例的构造函数属性(constructor)指向构造函数。

 console.log(person1.constructor == Person); //true
 console.log(person2.constructor == Person); //true

原型对象
每个函数对象都有一个prototype 属性,这个属性指向函数的原型对象;
每个对象都有 __ proto __ 属性,但只有函数对象才有 prototype 属性;

console.log(person1.sayName == person2.sayName); //true

在默认情况下,所有的原型对象都会自动获得一个 constructor(构造函数)属性,这个属性(是一个指针)指向 prototype 属性所在的函数(Person)

Person.prototype.constructor == Person

二 继承是如何实现的

原型链是实现继承的主要方法

三 ES6语法

四 Promise用法

五Angular/vue数据双向绑定如何实现的

六 angular 指令directive中@,=的使用

七 scope中的数据数据如何传递回element

八 gulp如何解决缓存问题

九 fs模块读取文件是同步还是异步

跨域问题:

服务端设置哪几个

客户端需要设置吗

有cookie的

你可能感兴趣的:(20180426前端笔记)