小记录

1 div1/span在div2中水平垂直居中

  【外层相对定位,里层绝对定位后,里层元素水平居中:left:50%;margin-left:-里层元素宽度/2;  垂直居中:top:50%;margin-top:-里层元素高度/2;     magin值均为负值。】

.wai{
    width: 200px;
    height: 200px;
    box-sizing: border-box;
    border: 2px solid black;
    
    position: relative;
    left: 230px;
}

.wai .li{
    width: 150px;
    height: 150px;
    border: 2px solid lightcoral;
    box-sizing: border-box;
    
    position: absolute;
    top: 50%;
    margin-top: -75px;
    left: 50%;
    margin-left: -75px;
}

 

.wai2{
    width: 200px;
    height: 200px;
    box-sizing: border-box;
    border: 2px solid black;
    text-align: center;

    line-height: 200px;
}
.wai2 span{
    width: 150px;
    height: 150px;
    border: 2px solid lightcoral;
    box-sizing: border-box;
}

 

2 遇到的下拉列表select右边下拉箭头问题

  【用appearance属性。appearance: none;表示不显示下拉箭头】

/*默认下拉列表select样式*/
.s1{
    width: 170px;
    height: 30px;
}
/*修改后*/
.s2{
    width: 170px;
    height: 30px;
    
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background: url(../img/read.gif) no-repeat scroll right center transparent;
    padding-right: 10px;
}
/*进行选择时不显示默认的外围线*/
.s2:focus{
    outline: none;
}

 3 圆角border-radius闲着没事练习

<div id="circle600">
    <div class="xiaobai"></div>
    <div class="xiaohei xiaobai"></div>
</div>
#circle600{
    width: 300px;
    height: 600px;
    border: 2px solid black;
    border-right: 298px solid black;
    border-radius: 300px;
}

#circle600 .xiaobai{
    width: 100px;
    height: 100px;
    background-color: black;
    border: 100px solid white;
    border-radius: 150px;
    margin-left: 150px;
    float: left;
}
#circle600 .xiaohei{
    background-color: white;
    border: 100px solid black;
}

4 暂时已熟练掌握的flex有关属性

1)指定容器为flex布局  【display:flex;】

2)项目在主轴上的对齐方式  

  【justify-content:  ;】  

  【flex-start向主轴开始的位置对齐  flex-end向主轴末尾对齐,项目顺序不变  center向主轴中心对齐】

  【space-between向主轴两端对齐,项目之间间隔相等  space-around主轴两边会空出距离相等的位置,但项目之间的间隔会比两边空出的距离大】

 

  ①flex-start向主轴开始的位置对齐(暂时定义主轴从左到右。)

 

  ②flex-end向主轴末尾对齐,项目顺序不变

 

  ③center向主轴中心对齐

 

  ④space-between向主轴两端对齐,项目之间间隔相等

 

  ⑤space-around主轴两边会空出距离相等的位置,但项目之间的间隔会比两边空出的距离大

 

 

3)决定主轴的方向  

  【flex-direction:  ;】

  【row主轴为水平,方向从左到右(默认值可以不设置)  row-reverse主轴为水平,方向从右到左,项目顺序与前一属性相反】

  【column主轴为垂直,方向从上到下  column-reverse主轴为垂直,方向从下到上】

  ①row主轴为水平,方向从左到右(默认值可以不设置)

  ②row-reverse主轴为水平,方向从右到左,项目顺序与前一属性相反

 

  ③column与column-reverse

 

    正常打开方式

    

 

posted on 2017-08-13 15:56  考拉一枚  阅读(170)  评论(0)    收藏  举报

导航