1.块元素水平垂直居中。
//样例块元素:
<div class="box1 box2 box3"></div>
//基础样式:
div{
width: 200px;
height: 200px;
background: #777;
}
//方法一:
.box1{
position: absolute;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -100px;
}
//方法二:
.box2{
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
//方法三,使用jQuery,js也可
$(window).resize(function(){
$(".box3").css({
position: "absolute",
left: ($(window).width() - $(".box3").outerWidth())/2,
top: ($(window).height() - $(".box3").outerHeight())/2
});
});//页面载入或窗口改变时都需要调用此方法
$(function(){
$(window).resize();
});
2.三个盒子,左右定宽,中间自适应,要求先加载中间块。
3.浮动的方法,清除浮动方法
4.css sprites定义和使用
5.用原生js给一个按钮绑定两个onclick事件
6.js中的定时器
7.ajax
//(1)创建异步对象
var ajax = new XMLHttpRequest();
//(2)设置请求的url参数(请求的类型;请求的url)
ajax.open('get', url);
//(3)发送请求
ajax.send();
//(4)注册事件onreadystatechange,状态改变时执行
ajax.onreadystatechange = function () {
if (ajax.readyState===4 && ajax.status===200) {
//(5)数据请求成功,且请求的页面是存在
console.log(ajax.responseText);//输入相应的内容
}
}
8.js的数据类型,其中undefined和null的区别
9.mvvm和mvc
10.px和em
11.优雅降级和渐进增强
————以上来源————
https://blog.csdn.net/zhang6223284/article/details/82843437
https://blog.csdn.net/weixin_43624724/article/details/86519903