CSS 魔法系列:纯 CSS 绘制图形(各种形状的钻石)
我们的网页因为 CSS 而呈现千变万化的风格。这一看似简单的样式语言在使用中非常灵活,只要你发挥创意就能实现很多比人想象不到的效果。特别是随着 CSS3 的广泛使用,更多新奇的 CSS 作品涌现出来。
《CSS 魔法系列》继续给大家带来 CSS 在网页中以及图形绘制中的使用。这篇文章给大家带来的是纯 CSS 绘制数学中的各种形状的砖石等。
您可能感兴趣的相关文章
Infinity
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #infinity { position : relative ; width : 212px ; height : 100px ; } #infinity:before, #infinity:after { content : "" ; position : absolute ; top : 0 ; left : 0 ; width : 60px ; height : 60px ; border : 20px solid red ; -moz-border-radius: 50px 50px 0 50px ; border-radius: 50px 50px 0 50px ; -webkit-transform: rotate( -45 deg); -moz-transform: rotate( -45 deg); -ms-transform: rotate( -45 deg); -o-transform: rotate( -45 deg); transform: rotate( -45 deg); } #infinity:after { left : auto ; right : 0 ; -moz-border-radius: 50px 50px 50px 0 ; border-radius: 50px 50px 50px 0 ; -webkit-transform: rotate( 45 deg); -moz-transform: rotate( 45 deg); -ms-transform: rotate( 45 deg); -o-transform: rotate( 45 deg); transform: rotate( 45 deg); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #diamond { width : 0 ; height : 0 ; border : 50px solid transparent ; border-bottom-color : red ; position : relative ; top : -50px ; } #diamond:after { content : '' ; position : absolute ; left : -50px ; top : 50px ; width : 0 ; height : 0 ; border : 50px solid transparent ; border-top-color : red ; } |
Diamond Shield
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #diamond-shield { width : 0 ; height : 0 ; border : 50px solid transparent ; border-bottom : 20px solid red ; position : relative ; top : -50px ; } #diamond-shield:after { content : '' ; position : absolute ; left : -50px ; top : 20px ; width : 0 ; height : 0 ; border : 50px solid transparent ; border-top : 70px solid red ; } |
Diamond Narrow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #diamond-narrow { width : 0 ; height : 0 ; border : 50px solid transparent ; border-bottom : 70px solid red ; position : relative ; top : -50px ; } #diamond-narrow:after { content : '' ; position : absolute ; left : -50px ; top : 70px ; width : 0 ; height : 0 ; border : 50px solid transparent ; border-top : 70px solid red ; } |
Cut Diamond
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #cut-diamond { border-style : solid ; border-color : transparent transparent red transparent ; border-width : 0 25px 25px 25px ; height : 0 ; width : 50px ; position : relative ; margin : 20px 0 50px 0 ; } #cut-diamond:after { content : "" ; position : absolute ; top : 25px ; left : -25px ; width : 0 ; height : 0 ; border-style : solid ; border-color : red transparent transparent transparent ; border-width : 70px 50px 0 50px ; } |
您可能感兴趣的相关文章
作者:山边小溪
主站:yyyweb.com 记住啦:)
欢迎任何形式的转载,但请务必注明出处。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
2012-11-19 分享20套精美的免费 PSD 网页加载进度条素材
2011-11-19 23个带给你灵感的国外单页网站设计精美范例