css3 文字流光渐变 背景模糊 边框两边伸展

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hongc93/article/details/62885269
  1. 文字流光渐变
    background-image:使用css3的渐变绘制图像,从左到右
    background-image: -webkit-linear-gradient(left, #3498db, #f47920 10%, #d71345 20%, #f7acbc 30%, #ffd400 40%, #3498db 50%, #f47920 60%, #d71345 70%, #f7acbc 80%, #ffd400 90%, #3498db);

    -webkit-background-clip:裁剪背景图像,使用文字作为裁剪区域向外裁剪,此时文字颜色仍覆盖背景图
    -webkit-background-clip: text;
    -webkit-text-fill-color:设置字体颜色。将字体颜色设置成透明,这样就能将背景图显示出来了
    -webkit-text-fill-color: transparent;
    background-size:背景图长度。背景图宽度拉长至两倍另外超出的半截颜色组用来实现流光效果
    background-size: 200% 100%
    animation:动画。
    @keyframes streamer {
    0% {
    background-position: 0 0;
    }
    100% {
    background-position: -100% 0;
    }
    }

  2. 背景模糊
    filter:图像设置高斯模糊。filter: blur(10px);
    transition:动画时间(transition: property duration timing-function delay;)
    鼠标移入移出都要效果就都加这个属性。
    transition: all 2s;
  3. 边框两边伸展
    用伪元素::before,::after来实现。
    两边散开:开始设置相对父容器的50%,在hover的时候,分别吧对应的left 和top值变为0。
section .con::before {
            content: '';
            position: absolute;
            height: 0;
            top: 50%;
            left: 0;
            width: 100%;
            overflow: hidden;
            border: 3px solid ghostwhite;
            border-width: 0 3px;
            transition: all 2s;
            box-sizing: border-box;
        }
        section:hover .con::before {
            height: 100%;
            top: 0;
            left: 0;
        }

效果预览请点击

猜你喜欢

转载自blog.csdn.net/hongc93/article/details/62885269