太酷了,纯 CSS 实现微软、谷歌和苹果的官方 Logo!

最近,我看到很多前端开发者用纯 CSS 重现各种经典 Logo,这简直是太酷了!这些作品不仅展示了 CSS 的强大功能,更体现了前端开发者的创意和技巧。

微软Logo

Microsoft Logo 非常简单,非常适合刚开始学习 CSS 的新手。

fed15eb10c2aa37312847a1a6fa5fd15.png
image.png
<body translate="no">
  <div class="logo">
  <div class="box box1"></div>
  <div class="box box2"></div>
  <div class="box box3"></div>
  <div class="box box4"></div>
</div>
<div class="logo-text">
  <p>Microsoft</p>
</div>
</body>
$text-color: #757575;
$background: #FFF;
$red: #F65314;
$green: #7CBB00;
$blue: #00A1F1;
$yellow: #FFBB00;

body {
  display: flex;
  height: 100vh;
  justify-content: center;
  align-items: center;
  background: $background;
  font-family: Helvetica;
}

.logo {
  height: 90px;
  width: 90px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: space-between;
  padding: 0px;
}

.box {
  height: 42.5px;
  width: 42.5px;
}

.box1 {
  background: $red;
}

.box2 {
  background: $green;
}

.box3 {
  background: $blue;
}

.box4 {
  background: $yellow;
}

.logo-text {
  font-size: 90px;
  margin-left: 20px;
  color: $text-color;
}

演示:https://codepen.io/omar110894/pen/LmMrmP

谷歌Logo

这个 Google Logo 只用了一个 div 就完成了,使用了 conic-gradient() CSS 函数,非常厉害!

20998b01345a1268fd9d0d4b0b0c06a3.pnghtml

<div class="google"></div>
<div class="google" style="--size: 20vw;"></div>
<div class="google" style="--size: 10vw;"></div>
<div class="google" style="--size: 5vw;"></div>

CSS

html,
body {
  --bg: #000000;
 min-height: 100vh;
 display: flex;
 align-content: center;
 justify-content: center;
 align-items: center;
  gap: 10px;
 background-color: var(--bg);
}

.google {
 --blue: #4285f4;
 --red: #ea4335;
 --green: #34a853;
 --yellow: #fbb605;
 --size: 30vw;
 position: relative;
 width: var(--size);
 height: var(--size);
 border-radius: 50%;
  background: conic-gradient(from 0deg at 32% 50%, var(--red) 20%, var(--blue) 20%, var(--blue) 37.5%, var(--green) 37.5%, var(--green) 62.5%, var(--yellow) 62.5%, var(--yellow) 87.5%, var(--red) 87.5%);
  clip-path: polygon(0% 0%, 100% 0%, 55% 44%, 100% 44%, 100% 100%, 0% 100%);
}

.google::before {
 content: "";
  position: absolute;
 display: block;
  background-color: var(--bg);
  width: calc(var(--size) * 0.6);
  height: calc(var(--size) * 0.6);
  border-radius: 50%;
  top: calc((var(--size) * 0.4)  / 2);
  left: calc((var(--size) * 0.4)  / 2);
  clip-path: polygon(0% 0%, 100% 0%, 100% 40%, 50% 40%, 50% 70%, 100% 70%, 100% 100%, 0% 100%);
}

演示:https://codepen.io/gwannon/pen/KKBEQqg

苹果Logo

cd72fbc06299b941cdcc3b051fb29e4a.png
image.png

Apple Logo  看起来不太容易用 CSS 实现一些巧妙的效果,你只能一点一点地构建它。

<div class="apple">
    <div class="top"><span></span></div>
    <div class="middle"><span></span></div>
    <div class="footer"></div>
</div>
.apple, .butt:before, .top span:after, .middle:after, .top:before, .top:after, .middle:before, .butt:after {
    background: #FFF; /* foreground color */
}
body, .footer, .middle span, .middle, .top, .top span {
 background: #CCC; /* background color */
}
.apple {
    width: 230px;
    height: 200px;
    border-radius: 36% 36% 41% 41% / 42% 42% 75% 75%;   
    position: relative;
    margin: 80px auto 0;
}
.footer {
    position: absolute;
    width: 60%;
    height: 62%;
    right: -40%;
    top: 8%;
    border-radius: 60%;
}
.middle span {
    display: block;
    position: absolute;
    border-radius: 100% 100% 0% 0%;
    width: 24.5%;
    height: 400%;
    bottom: -239%;
    left: 38%;
}
.middle {
    position: absolute;
    width: 100%;
    height: 4%;
    bottom: -1%;
}
.middle:before {
    content: '';
    position: absolute;
    width: 24%;
    height: 400%;
    border-radius: 0% 0% 100% 100%;
    left: 21%;
    bottom: 38%;
}
.middle:after {
    content: '';
    position: absolute;
    width: 23.4%;
    height: 400%;
    border-radius: 0% 0% 100% 100%;
    right: 21%;
    bottom: 38%;
}


.top span {
    display: block;
    position: absolute;
    border-radius: 0 0 44% 44% / 0 0 100% 100%;
    width: 63%;
    height: 259%;
    top: -92%;
    left: 18.6%;
    z-index: 3;
}
.top span:after {
    border-radius: 100% 0 100% 0;
    content: "";
    height: 242%;
    left: 41%;
    position: absolute;
    top: -193%;
    width: 90%;
}
.top {
    position: absolute;
    width: 42%;
    height: 4%;
    top: 0px;
    left: 29%;
}
.top:before {
    content: '';
    position: absolute;
    width: 62%;
    height: 260%;
    border-radius: 100% 100% 0% 0% / 100% 200% 0% 0%;
    left: -27%;
    top: 1%;
}
.top:after {
    content: '';
    position: absolute;
    width: 62%;
    height: 260%;
    border-radius: 100% 100% 0% 0% / 200% 100% 0% 0%;
    right: -27%;
    top: 1%;
}

演示:https://codepen.io/guicheffer/pen/XJYdmE

这些作品真是太惊艳了,展现了前端开发者们对 CSS 的巧妙运用和无限创意,让人忍不住惊叹!

希望这些例子能激励你,不断挑战自己的 CSS 技能,用代码创作出更多精彩的作品!

关注我,下期分享更多有趣的 CSS Logo。


最后,如果你觉得宝哥的分享还算实在,就给我点个赞,关注一波。分享出去,也许你的转发能给别人带来一点启发。

往期推荐

38个Vue、Nuxt 和 Vite 技巧、窍门和实践的合集

12 种 Vue 设计模式

CSS 秘密武器:25 个小技巧,助你写出更优雅的代码!

JavaScript 的新技能:5 大技巧,打造更强大的 Web 应用

Vue 3 表单大揭秘:用 ref、组合式 API 和 v-for 打造你的专属表单!

程序员必备:9 个超赞的速查表网站,2024 年开发效率翻倍!

Vue 如何处理异步组件加载错误

Vue 3 将推出新特性,可以抛弃虚拟DOM了!

我是宝哥。欢迎长按加我好友,第一时间和你分享前端行业趋势,面试资源,学习途径等等。

3bfebc85597f11d5c4dc0c80686b349d.png

添加好友备注【加群】拉你进技术交流群

公众号前端开发博客 专注前端开发技术,分享前端开发资源和 WEB 前沿资讯,如果喜欢我的分享,给 宝哥 点一个  或者 分享 都是对我的支持

关注公众号后,在首页:

  • 回复「小抄」,领取Vue、JavaScript 和 WebComponent 小抄 PDF

  • 回复「Vue脑图」获取 Vue 相关脑图

  • 回复「思维图」获取 JavaScript 相关思维图

  • 回复「简历」获取简历制作建议

  • 回复「简历模板」获取精选的简历模板

  • 回复「电子书」下载我整理的大量前端资源,含面试、Vue实战项目、CSS和JavaScript电子书等。

  • 回复「知识点」下载高清JavaScript知识点图谱

  • 回复「读书」下载成长的相关电子书

如果觉得不错,欢迎点赞、收藏、分享❤❤

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值