博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
border-radius结合动画创建酷炫的效果
阅读量:7197 次
发布时间:2019-06-29

本文共 1938 字,大约阅读时间需要 6 分钟。

如何使用border-radius创建酷炫的效果

border-radius圆角

  • CSS3圆角只需设置一个属性:border-radius(含义是"边框半径")。你为这个属性提供一个值,就能同时设置四个圆角的半径。所有合法的CSS度量值都可以使用:em、ex、pt、px、百分比等等。不允许负值。
  • 椭圆的水平半径"(horizontal radius)和"垂直半径"(vertical radius)如border-radius: 15px;

border-radius: 30% 70% 20% 40%图解

border-radius: 4em 8em及border-radius: 4em / 8em 图解

border-radius 70% 30% 30% 70% / 60% 40% 60% 40%解释

border-radius结合动画应用

* {  box-sizing: border-box;}body {  background: #003;}.container {  height: 100vh;  display: flex;  align-items: center;  justify-content: center;  overflow: hidden;}.box {  width: 60vmin;  height: 60vmin;  border: 1px dashed rgba(255,255,255,0.4);  position: relative;    &::before {    content: "";    position: absolute;    top: 0;    left: 0;    bottom: 0;    right: 0;    border-radius: 50%;    border: 1px dashed rgba(255,255,255,0.4);    transform: scale(1.42);  }}.spin-container {  width: 100%;  height: 100%;  animation: spin 12s linear infinite;  position: relative;}.shape {  width: 100%;  height: 100%;  transition: border-radius 1s ease-out;  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;  animation: morph 8s ease-in-out infinite both alternate;  position: absolute;  overflow: hidden;  z-index: 5;}.bd {  width: 142%;  height: 142%;  position: absolute;  left: -21%;  top: -21%;  background: url(https://images.unsplash.com/photo-1519345182560-3f2917c472ef?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2868fd5c3f30697d38732224e0ef51ed);  background-size: 100%;  background-position: center center;  display: flex;  color: #003;  font-size: 5vw;  font-weight: bold;  align-items: center;  justify-content: center;  text-align: center;  text-transform: uppercase;  animation: spin 12s linear infinite reverse;  opacity: 1;  z-index: 2;}@keyframes morph {  0% {border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;}   100% {border-radius: 40% 60%;} }@keyframes spin {  to {    transform: rotate(1turn);  }}复制代码

参考链接

转载地址:http://nmzum.baihongyu.com/

你可能感兴趣的文章
Linux 目录卡死
查看>>
微服务框架Spring Cloud之使用事件和消息队列实现分布式事务
查看>>
碉堡了Ubuntu Core Linux支持 TS-4900 物联网开发板
查看>>
如何在多Kubernetes集群和多租户环境中使用Prometheus监控
查看>>
Thymeleaf教程 (十) 属性的优先级列表
查看>>
linux中 vi / vim显示行号或取消行号命令
查看>>
Python学习笔记 - 02: 用Python Client连接ElasticSearch操作数据
查看>>
2018年前端开发回顾
查看>>
微信小程序访问webService(Java)
查看>>
QT从QObject实现多重继承
查看>>
Hystrix的配置属性优先级和详解
查看>>
PyCharm入门教程——用字符串文字拆分行
查看>>
量化交易系统平台开发:量化交易的门类区分
查看>>
高级开发不得不懂的Redis Cluster数据分片机制
查看>>
突然,form表单参数提交,但是java接收不到
查看>>
开发Yii2过滤器并通过behaviors()行为调用
查看>>
白话SpringCloud | 第零章:前言
查看>>
XMind中的“任务信息”视图
查看>>
OSChina 双十一乱弹 ——来自单身狗的哀鸣
查看>>
OSChina 周三乱弹 ——我们职业更好的名字:爱码士
查看>>