bootstrap 笔记

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对应的索引
            }
        }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值