当前位置:首页 > CSS

css谷歌logo制作

2026-04-02 00:30:30CSS

使用CSS绘制谷歌Logo

谷歌Logo由四个彩色字母组成,可以通过CSS的伪元素和背景色实现。以下是具体实现方法:

HTML结构只需一个容器元素:

<div class="google-logo"></div>

CSS样式代码:

.google-logo {
  position: relative;
  width: 240px;
  height: 80px;
}

.google-logo::before {
  content: "G";
  position: absolute;
  left: 0;
  color: #4285F4;
  font-size: 80px;
  font-weight: bold;
  font-family: 'Product Sans', Arial, sans-serif;
}

.google-logo::after {
  content: "oogle";
  position: absolute;
  left: 60px;
  color: #EA4335;
  font-size: 80px;
  font-weight: bold;
  font-family: 'Product Sans', Arial, sans-serif;
}

.google-logo span:first-child {
  position: absolute;
  left: 120px;
  color: #FBBC05;
  font-size: 80px;
  font-weight: bold;
  font-family: 'Product Sans', Arial, sans-serif;
}

.google-logo span:last-child {
  position: absolute;
  left: 180px;
  color: #34A853;
  font-size: 80px;
  font-weight: bold;
  font-family: 'Product Sans', Arial, sans-serif;
}

纯CSS绘制方案(无文本)

如需完全用CSS绘制(不使用文字),可采用以下方案:

<div class="google-logo">
  <div class="blue"></div>
  <div class="red"></div>
  <div class="yellow"></div>
  <div class="green"></div>
</div>
.google-logo {
  position: relative;
  width: 240px;
  height: 80px;
}

.google-logo div {
  position: absolute;
  width: 60px;
  height: 80px;
}

.blue {
  left: 0;
  background: #4285F4;
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 60%, 60% 100%, 0 100%);
}

.red {
  left: 60px;
  background: #EA4335;
  clip-path: circle(40px at 30px 40px);
}

.yellow {
  left: 120px;
  background: #FBBC05;
  clip-path: polygon(0 20%, 100% 20%, 100% 80%, 0 80%);
}

.green {
  left: 180px;
  background: #34A853;
  clip-path: polygon(40% 0, 100% 0, 100% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
}

动画效果增强

添加悬停动画效果:

css谷歌logo制作

.google-logo:hover div {
  transform: translateY(-10px);
  transition: transform 0.3s ease;
}

.blue { transition-delay: 0.1s; }
.red { transition-delay: 0.2s; }
.yellow { transition-delay: 0.3s; }
.green { transition-delay: 0.4s; }

注意事项

  1. 字体推荐使用谷歌的Product Sans或Roboto
  2. 颜色值使用谷歌官方色值:
    • 蓝色:#4285F4
    • 红色:#EA4335
    • 黄色:#FBBC05
    • 绿色:#34A853
  3. 对于更复杂的形状,建议使用SVG方案

标签: css谷歌
分享给朋友:

相关文章

怎么制作css文档

怎么制作css文档

创建CSS文档的基本步骤 新建一个纯文本文件,将文件后缀名改为.css,例如styles.css。使用代码编辑器(如VS Code、Sublime Text等)打开文件,开始编写CSS规则。 编写C…

css怎么制作首字下沉

css怎么制作首字下沉

首字下沉的实现方法 首字下沉是一种常见的排版效果,通过放大段落的首字母并使其下沉,可以增强文本的视觉吸引力。以下是几种实现方法: 使用::first-letter伪元素 通过CSS的::first-…

如何制作css雪碧图

如何制作css雪碧图

什么是CSS雪碧图 CSS雪碧图(CSS Sprite)是一种将多个小图标或背景图像合并到一张大图中的技术,通过CSS的background-position属性控制显示特定部分。这种技术可以减少HT…

css 制作

css 制作

CSS 制作基础 CSS(层叠样式表)用于控制网页的样式和布局。通过CSS,可以定义字体、颜色、间距、背景等视觉效果,使HTML内容更具吸引力。 内联样式 直接在HTML元素的style属性中编写C…

制作css开关

制作css开关

使用纯CSS创建开关 HTML结构需要包含一个隐藏的复选框和一个关联的标签元素: <label class="switch"> <input type="checkbox"&g…

css制作导航

css制作导航

CSS 制作导航的方法 基础水平导航栏 使用无序列表(<ul>)和浮动(float)或 Flexbox 布局实现水平导航: <nav> <ul class="ho…