day05

今天学了什么

1.设置边框圆角

//css
border-radius:10px;
//html
<div>
</div>

2.给元素加阴影

//css
<style>
 p{
   text-shadow: 10px 10px 8px red;
 }
</style>
//html
 <p>hello world</p>
阴影特效.png

3.显示文本溢出内容

//css
 <style>
        p{
          text-overflow: ellipsis;
          overflow: hidden;   
        }
    </style>
//html
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime maiores, nam quas amet alias, dignissimos consectetur magni dolores ex repellendus doloremque! Obcaecati dolores architecto quae impedit natus? Sed, voluptate placeat.</p>
文本溢出.png

3.1文本溢出加省略号

//css
<style>
        p{
          /* 已省略号结尾 */
          text-overflow: ellipsis;
          overflow: hidden;  
          /* 是否换行 */
          white-space: nowrap;
        }
    </style>
//html
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime maiores, nam quas amet alias, dignissimos consectetur magni dolores ex repellendus doloremque! Obcaecati dolores architecto quae impedit natus? Sed, voluptate placeat.</p>
溢出部分加省略号.png

4.CSS 2D转换

4.1.旋转 transform: rotate(度数);

transform: rotate(30deg);
该元素移动的位置,取决于宽度(X轴)和高(Y)

4.2.位移translate(x,y)

x横坐标方向移动的距离,y纵坐标方向移动的距离
transform: translate(50px,50px);

4.3.缩放scaleX 水平缩放

scaleY 垂直缩放
scale(x,y)
transform: scaleY(0.5);

4.4.倾斜

ransform: skewY(10deg);

//css
    <style>
        div{
         width: 100px;
         height: 100px;
         background: red;
        }
        div{ 
            transform: skewY(10deg);
        }
    </style>
//html
  <div>
    </div>
倾斜.png
4.5垂直水平居中
//css
  <style>
        .parent{
            width: 200px;
            height: 200px;
            background: red;
            position: relative;
        }
        .child{
            width: 100px;
            height: 100px;
            background: pink;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
        }
    </style>
//html
  <div class="parent">
        <div class="child">
        </div>
    </div>
垂直水平居中.png

5.过渡

改变宽度时长1s

//css
    <style>
        div{
          width: 100px;
          height: 100px;  
          background: red;
          transition: width 1s;
        }
        div:hover{
            width:200px;
        }
</style>
//html
 <div>
</div> 

6.animation动画

1秒钟变化五次

 <style>
        div{
            width: 100px;
            height: 100px;
            background:red;
            animation: myAnimate 2s;
        }
        @keyframes myAnimate{
            0%{
                width: 100px;
                height: 100px;
            }
            20%{
                width: 200px;
                height: 200px;
                background: yellow;
            }
            50%{
                width: 300px;
                height: 200px;
                background: pink; 
            }
           100%{
                width: 100px;
                height: 100px;
                background: red; 
            }
        }
    </style>
//html
<div>
</div>

6.1外部导入动画

https://daneden.github.io/animate.css/

//css
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css">
//html
 <p class="animated  tada">hello world</p>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 关于css3变形 CSS3变形是一些效果的集合,比如平移、旋转、缩放和倾斜效果,每个效果都被称作为变形函数(Tra...
    hopevow阅读 6,589评论 2 13
  • Transform字面上就是变形,改变的意思。在CSS3中transform主要包括以下几种:旋转rotate、扭...
    hzrWeber阅读 22,276评论 0 19
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,470评论 0 11
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    wzhiq896阅读 2,157评论 0 2
  • 看了很多视频、文章,最后却通通忘记了,别人的知识依旧是别人的,自己却什么都没获得。此系列文章旨在加深自己的印象,因...
    DCbryant阅读 1,998评论 0 4

友情链接更多精彩内容