[CSS] Create Complex Shapes with CSS Clip Path and Border Radiusc (border-radius & clip-path)
2023-09-14 09:00:47 时间
In this lesson, we explore creating the Egghead Shell with CSS. We explore how different properties allow us to create different shapes and how we can use our developer tools to adjust and tweak style values.
*, *:before, *:after { box-sizing: border-box; } :root { --bg: #ffd500; --shell: #fff; --shell-outline: #666; --size: 50; --unit: calc((var(--size) / 769) * 1vmin); } body { background-color: var(--bg); min-height: 100vh; } img { opacity: 0.5; } .egg { background-color: hsla(0, 100%, 50%, 0.2); } img, .egg { height: calc(769 * var(--unit)); width: calc(742 * var(--unit)); position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); } .shell { height: 95%; width: 74%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .shell__piece--top { height: 108%; width: 106%; border-radius: 50% 50% 0 0 / 85% 85% 0 0; top: 0; clip-path: inset(0 0 70% 0); } .shell__piece--middle { height: 100%; width: 98%; border-radius: 50% 50% 0 0 / 85% 85% 0 0; clip-path: inset(32% 0 40% 0); } .shell__piece--bottom { bottom: 0; border-radius: 50% / 62% 62% 38% 38%; width: 100%; height: 100%; clip-path: inset(58% 0 0 0); } .shell__piece { background-color: var(--shell); border: calc(26 * var(--unit)) solid var(--shell-outline); position: absolute; left: 50%; transform: translate(-50%, 0); }
border-radius:
border-radius: 50% 50% 0 0 / 85% 85% 0 0;
first (50% + 85%)
x: top-left, move right 50%
y: top-left, move down 85%
second (50% + 85%)
x: top-right, move left 50%
y: top-right, move down 85%
first and second (0 0)
no changes
clip-path:
Image:
before:
after clip:
clip-path: inset(87% 45% 5% 46%);
相关文章
- python copy&deepcopy
- Q&A特辑 | 看了这场直播,我找到了设备指纹“从不说谎”的原因
- [AI安全论文] 21.S&P21 Survivalism经典离地攻击(Living-Off-The-Land)恶意软件系统分析
- Go进阶训练营 – 微服务概览与治理四:多集群 & 多租户
- css 更改所有text,CSS之cssText「建议收藏」
- 在html中加入外部css样式,如何引入CSS样式表?
- 第2章 WEB02-CSS&JS篇-视频教程-第一部分
- html空格代码 _html中的转义字符
- @DependsOn & 控制多个(不同)的@Bean的加载顺序
- 使用html css实现180箭头旋转,纯CSS实现箭头旋转「建议收藏」
- JavaEE8 - Number&Math&Character类
- ECCV2022 &CVPR2022论文速递2022.7.28!
- 计算机底层知识之内存和磁盘的关系&数据压缩
- EMQX Enterprise 4.4.12&4.4.13 发布:集群负载重平衡、TDengine 3.0 适配以及子表批量插入
- Topaz Photo AI mac&win(人工智能降噪软件)
- 解密Prompt系列2. 冻结Prompt微调LM: T5 & PET & LM-BFF
- 谈谈你对SSM简答题的理解 && SpringMVC执行流程
- 前端必备的 CSS 库,normalize.css
- 【CSS教程】紫色渐变登陆布局html+css代码
- 微信公众平台开发(二)——自定义菜单、模板消息&微信素材
- 7 Papers & Radios | Transformer新变体∞-former;谷歌1370亿参数模型比GPT-3更强
- virtual dom & mvvm详解编程语言
- The Shapes of CSS(css的形状)详解编程语言
- CSS与MySQL合力提升网页性能(css与mysql结合)
- MySQL登陆系统CSS实现一键登录(css mysql登陆)
- AMP与Oracle结合提升数据库性能($amp oracle)
- CSS规则层叠的应用css必须要注意的几点
- CSS顶级技巧大放送,div+css布局必知
- CSS教程之css选择器、属性、值
- php压缩多个CSS为一个css的代码并缓存
- 修复IE9&safari的sort方法
- 如何使用jquery控制CSS样式,并且取消Css样式(如背景色,有实例)