惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

静水深流's blog

探索 SSE:服务器推送技术的魅力与应用 | 静水深流 图解DIFF算法介绍 | 静水深流 如何使用javascript实现复制出的文案带链接? | 静水深流 基于vuepress2搭建专属自己的博客,并集成各种常用功能 | 静水深流 听说你至今不晓得缓存淘汰算法?实现LRU、LFU和FIFO? | 静水深流 最长递增子序列及vue3.0中diff算法 | 静水深流 二进制之入门到应用实践 | 静水深流 常见算法学习 | 静水深流 ajax取消接口请求 | 静水深流 前端常见的安全问题 | 静水深流 关于http服务端的学习&总结 | 静水深流 前端面试题总结 | 静水深流 javascript原生代码实现及代码总结 | 静水深流 LeetCode算法学习总结-简单 | 静水深流 LeetCode算法学习总结-困难 | 静水深流 LeetCode算法学习总结- 中等 | 静水深流 排序算法总结 | 静水深流 扫码登录的实现原理 | 静水深流 Javascript之常见类型判断汇总 | 静水深流 JavaScript各种继承方式和优缺点 | 静水深流 webpack开发、使用及优化总结 | 静水深流 从JavaScript中的拷贝开始思考 | 静水深流 vue原理、使用及面试方面的总结 | 静水深流 前端发展及选择 | 静水深流 css面试总结 | 静水深流 JavaScript 数组展开(扁平化)和underscore的 flatten | 静水深流 文章列表 | 静水深流 首页 | 静水深流 学习网站收藏 | 静水深流
CSS 形状的实现 | 静水深流
2022-08-08 · via 静水深流's blog

正方形

正方形

.test{
  width: 100px;
  height: 100px;
  background: #46bd87
}

长方形

长方形

.test{
  width: 160px;
  height: 80px;
  background: #46bd87
}

圆形

圆形

.test{
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #46bd87
}

椭圆形

椭圆形

.test{
  width: 160px;
  height: 80px;
  border-radius: 80px/40px;
  background: #46bd87
}

宽度和长度成比例自适应缩放

椭圆形

.test{
  width: 100%;
  padding-bottom: 50%;  /* padding长是宽的一半 */
  background: #46bd87
}

向下三角形(向上、向左、向右同理)

三角形

.test{
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-top: 100px solid #46bd87;
}

直角三角形(替它三个方向同理)

三角形

.test{
  width: 0;
  height: 0;
  border-top: 100px solid #46bd87;
  border-left: 100px solid transparent;
}

箭头

箭头

.test {
  position: relative;
  width: 0;
  height: 0;
  border-top: 20px solid transparent;
  border-right: 20px solid #46bd87;
  transform: rotate(10deg);
  margin: 20px /* 不重要 */
}
.test:after {    
  content: "";
  position: absolute;
  border: 0 solid transparent;
  border-top: 9px solid#46bd87;
  border-radius: 50px 0 0 0;
  top: -32px;
  left: -31px;
  width: 36px;
  height: 36px;
  transform: rotate(45deg);
}

箭头

心

.test {
  position: relative;
  width: 100px;
  height: 90px;
}
.test:before,
.test:after {
  position: absolute;
  content: "";
  left: 50px;
  top: 0;
  width: 50px;
  height: 80px;
  background: red;
  border-radius: 50px 50px 0 0;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
}
.test:after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

提示框

提示框

.test {
  width: 120px;
  height: 80px;
  background: #46bd87;
  position: relative;
  -moz-border-radius:    10px;
  -webkit-border-radius: 10px;
  border-radius:         10px;
}
.test:before {
  content:"";
  position: absolute;
  right: 100%;
  top: 26px;
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-right: 26px solid #46bd87;
  border-bottom: 13px solid transparent;
}

放大镜

放大镜

.test {
  display: inline-block;
  width: 0.8em;
  box-sizing: content-box;
  height: 0.8em;
  border: 0.1em solid #46bd87;
  position: relative;
  border-radius: 0.8em;
  font-size: 50px
}
.test:before {
  content: "";
  display: inline-block;
  position: absolute;
  right: -0.25em;
  bottom: -0.1em;
  border-width: 0;
  background: #46bd87;
  width: 0.4em;
  height: 0.1em;
  transform: rotate(45deg);
}

十字架

十字架

.test {
  background: #46bd87;
  height: 100px;
  position: relative;
  width: 20px;
  margin-left: 30px
}
.test:after {
  background: #46bd87;
  content: "";
  height: 20px;
  left: -40px;
  position: absolute;
  top: 40px;
  width: 100px;
}

小红包免费领

小礼物走一走