day08

A

一、公共样式提取

样式复用,提高效率
基本的css三层结构:
base.css common.css page.css
对应于普遍适用,公司适用,项目适用

二、css2d转换--transform属性

transform属性值:
//位移
translate(x,y)
x,y值为px时位移px距离,值为百分比时,位移自身高宽*百分比
//旋转
rotate()
n为旋转度数,单位deg
//缩放
scale(x,y)
x,y为数值时,分别代表水平垂直缩放x,y倍
//倾斜
skew(x,y)
x,y为度数,分别在水平,垂直上倾斜x,y度
skew(x,y)属性中,x+y=90时,图形会消失(拉平成一条线),x+y=180时,图形不会改变,x=y时,图形为一对角为x,y的菱形

写法:
transform:translate(x,y);
transform:rotate(n);
transform:scale(x,y);
transform:skew(x,y);

三、(css2d转换的)过渡--transition属性,配合hover使用

transition:要过渡的属性名1 过渡时间1,要过渡的属性名2过渡时间2...;
.transition-test {
            width: 150px;
            height: 150px;
            background-color: #6149ff;
            transition: all 0.3s;
        }

        .transition-test:hover {
            transform: translate(0, -5px);
            box-shadow: 0 0 5px 3px #a37aff;
        }

四、层级定位(position)实现垂直水平居中的三种写法

方法一:
<div class="parent">
  <div class="child">
  </div>
</div>

<style>
.parent{
width:500px;
height:500px;
background-color:#000;
position:relative;
}

.child{
width:200px;
height:200px;
background-color:#fff;
position:absolute;

top:50%;
left:50%;

margin-top:-100px;
margin-left:-100px;
}
</style>

方法二:
对方法一中最后2行相同效果的不同写法
transform:translate(-50%,-50%);

方法三:
对方法一中最后4行相同效果的不同写法
top:0;
right:0;
bottom:0;
left:0;
margin:auto;
最简单但看起来不科学...

B

一、公共样式提取

样式复用,提高效率
基本的css三层结构:
base.css common.css page.css
对应于普遍适用,公司适用,项目适用

二、css2d转换--transform属性

transform属性值:
//位移
translate(x,y)
x,y值为px时位移px距离,值为百分比时,位移自身高宽*百分比
//旋转
rotate()
n为旋转度数,单位deg
//缩放
scale(x,y)
x,y为数值时,分别代表水平垂直缩放x,y倍
//倾斜
skew(x,y)
x,y为度数,分别在水平,垂直上倾斜x,y度

写法:
transform:translate(x,y);
transform:rotate(n);
transform:scale(x,y);
transform:skew(x,y);

三、(css2d转换的)过渡--transition属性,配合hover使用

transition:要过渡的属性名1 过渡时间1,要过渡的属性名2过渡时间2...;
.transition-test {
            width: 150px;
            height: 150px;
            background-color: #6149ff;
            transition: all 0.3s;
        }

        .transition-test:hover {
            transform: translate(0, -5px);
            box-shadow: 0 0 5px 3px #a37aff;
        }

四、层级定位(position)实现垂直水平居中的三种写法

方法一:
<div class="parent">
  <div class="child">
  </div>
</div>

<style>
.parent{
width:500px;
height:500px;
background-color:#000;
position:relative;
}

.child{
width:200px;
height:200px;
background-color:#fff;
position:absolute;

top:50%;
left:50%;

margin-top:-100px;
margin-left:-100px;
}
</style>

方法二:
对方法一中最后2行相同效果的不同写法
transform:translate(-50%,-50%);

方法三:
对方法一中最后4行相同效果的不同写法
top:0;
right:0;
bottom:0;
left:0;
margin:auto;
最简单但看起来不科学...

C

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • A我今天学到了什么 垂直水平居中的3种方法 1.用transform垂直水平居中 2.用position水平居中 ...
    孔子曰_f425阅读 309评论 1 0
  • 1,今天我学会了 1.公共样式的提取 2.css2d转换 配合transform属性使用 2.1translate...
    613桑阅读 349评论 0 0
  • A我今天学习到了什么 1温习day07的知识点 1.实现一个下拉菜单//运用知识点float,position 2...
    尘榆骡厌阅读 157评论 0 0
  • 今天早上陪媳妇去买菜,媳妇买了一位老大娘三块钱的土豆和四块钱的蜜桃,媳妇给了她十块钱,她又找给媳妇六块钱。媳...
    松峰说教刘树森阅读 285评论 0 3