http://www.juhaoyong.net/n/bootstrap/liepailie.html
offset 补偿(课本上或相关教程上一般都把这个叫做“偏移”),其实就是在左侧补列(1~11列)
push 推
pull 拉
偏移、推、拉,都有一个参照物,即相对的位置,那就是左侧, 相对于左侧偏移、推、拉
写法比如:
col-md-offset-3(在左侧补充3列)
col-md-push-8(从左侧往右侧推8列)
col-md-pull-2(往左侧拉2列)
div 垂直水平居中
https://zhidao.baidu.com/question/558984366971173044.html
方法1:
.parent {
width:800px;
height:500px;
border:2px solid #000;
position:relative;
}
.child {
width:200px;
height:200px;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background-color: red;
}
方法2:
.parent {
width:800px;
height:500px;
border:2px solid #000;
display:table-cell;
vertical-align:middle;
text-align: center;
}
.child {
width:200px;
height:200px;
display:inline-block;
background-color: red;
}
方法3:
.parent {
width:800px;
height:500px;
border:2px solid #000;
display:flex;
justify-content:center;
align-items:center;
}
.child {
width:200px;
height:200px;
background-color: red;
}
方法4:
.parent {
width:800px;
height:500px;
border:2px solid #000;
position:relative;
}
.child {
width:300px;
height:200px;
margin:auto;
position:absolute;/*设定水平和垂直偏移父元素的50%,
再根据实际长度将子元素上左挪回一半大小*/
left:50%;
top:50%;
margin-left: -150px;
margin-top:-100px;
background-color: red;
}
for (var i = 0; i < peopleImgs.length; i++) {
peopleImgs[i].index = i; //为每个li添加对应的索引index
peopleImgs[i].onmouseover = function () { //循环为每个li添加onclick事件
for (var i = 0; i < peopleImgs.length; i++) {
// peopleImgs[i].className = ''; //循环清空li样式
rowdetail[i].style.display = 'none'; //循环隐藏所有div
}
// rowdetail.style.display = 'block';
rowdetail[this.index].style.display = 'block'; //this.index 获取当前li对应的索引
}
}
offset 补偿(课本上或相关教程上一般都把这个叫做“偏移”),其实就是在左侧补列(1~11列)
push 推
pull 拉
偏移、推、拉,都有一个参照物,即相对的位置,那就是左侧, 相对于左侧偏移、推、拉
写法比如:
col-md-offset-3(在左侧补充3列)
col-md-push-8(从左侧往右侧推8列)
col-md-pull-2(往左侧拉2列)
div 垂直水平居中
https://zhidao.baidu.com/question/558984366971173044.html
方法1:
.parent {
width:800px;
height:500px;
border:2px solid #000;
position:relative;
}
.child {
width:200px;
height:200px;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
background-color: red;
}
方法2:
.parent {
width:800px;
height:500px;
border:2px solid #000;
display:table-cell;
vertical-align:middle;
text-align: center;
}
.child {
width:200px;
height:200px;
display:inline-block;
background-color: red;
}
方法3:
.parent {
width:800px;
height:500px;
border:2px solid #000;
display:flex;
justify-content:center;
align-items:center;
}
.child {
width:200px;
height:200px;
background-color: red;
}
方法4:
.parent {
width:800px;
height:500px;
border:2px solid #000;
position:relative;
}
.child {
width:300px;
height:200px;
margin:auto;
position:absolute;/*设定水平和垂直偏移父元素的50%,
再根据实际长度将子元素上左挪回一半大小*/
left:50%;
top:50%;
margin-left: -150px;
margin-top:-100px;
background-color: red;
}
for (var i = 0; i < peopleImgs.length; i++) {
peopleImgs[i].index = i; //为每个li添加对应的索引index
peopleImgs[i].onmouseover = function () { //循环为每个li添加onclick事件
for (var i = 0; i < peopleImgs.length; i++) {
// peopleImgs[i].className = ''; //循环清空li样式
rowdetail[i].style.display = 'none'; //循环隐藏所有div
}
// rowdetail.style.display = 'block';
rowdetail[this.index].style.display = 'block'; //this.index 获取当前li对应的索引
}
}