当前位置:首页 > CSS

css制作google

2026-01-28 03:19:32CSS

使用CSS制作Google首页样式

创建一个类似Google首页的页面需要关注简洁的布局、搜索框和按钮样式。以下是关键CSS代码和实现方法:

HTML结构

<div class="google-container">
  <div class="logo">Google</div>
  <div class="search-container">
    <div class="search-box">
      <input type="text" class="search-input">
    </div>
    <div class="buttons">
      <button class="search-button">Google Search</button>
      <button class="feeling-lucky">I'm Feeling Lucky</button>
    </div>
  </div>
</div>

CSS样式

.google-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 100px;
}

.logo {
  font-size: 80px;
  font-weight: bold;
  margin-bottom: 30px;
  color: #4285F4;
}

.search-container {
  width: 100%;
  max-width: 584px;
}

.search-box {
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  height: 44px;
  padding: 0 16px;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  font-size: 16px;
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.search-button, .feeling-lucky {
  background-color: #f8f9fa;
  border: 1px solid #f8f9fa;
  border-radius: 4px;
  color: #3c4043;
  padding: 8px 16px;
  font-size: 14px;
}

.search-button:hover, .feeling-lucky:hover {
  border: 1px solid #dadce0;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

关键设计要点

Google首页设计以简洁为核心,主要元素包括居中布局、无边框搜索框和简单的按钮样式。搜索框采用圆角边框,按钮使用浅灰色背景。

颜色方案遵循Google的品牌色,Logo使用蓝色#4285F4,按钮和搜索框使用中性灰色调。交互效果包括鼠标悬停时按钮的轻微阴影和边框变化。

响应式调整

为适应不同屏幕尺寸,可添加媒体查询:

@media (max-width: 600px) {
  .logo {
    font-size: 60px;
  }

  .search-container {
    width: 90%;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
  }
}

动画增强效果

为搜索框添加聚焦动画:

css制作google

.search-box:focus-within {
  box-shadow: 0 1px 6px rgba(32,33,36,0.28);
  border-color: rgba(223,225,229,0);
}

这种实现保留了Google首页的核心视觉元素,同时保持代码简洁。可根据需要进一步添加导航栏、页脚等其他组件。

标签: cssgoogle
分享给朋友:

相关文章

css制作六边形

css制作六边形

使用CSS创建六边形的方法 通过CSS的clip-path属性可以轻松实现六边形效果。以下是一个基础示例: .hexagon { width: 100px; height: 55px;…

css制作搜索框

css制作搜索框

制作搜索框的基本结构 使用HTML创建一个简单的搜索框结构,包含输入框和搜索按钮: <div class="search-box"> <input type="text" pl…

css右导航栏制作

css右导航栏制作

CSS右导航栏制作方法 固定定位法 使用position: fixed将导航栏固定在视窗右侧,结合right和top属性控制位置。示例代码: .right-navbar { position:…

网页制作css是什么

网页制作css是什么

CSS的定义与作用 CSS(Cascading Style Sheets,层叠样式表)是一种用于描述网页外观和格式的样式语言。它通过定义HTML元素的布局、颜色、字体等视觉属性,实现内容与表现的分离,…

制作css

制作css

制作CSS的基础方法 CSS(层叠样式表)用于控制网页的样式和布局。以下是创建和使用CSS的基本方法。 内联样式 直接在HTML元素的style属性中编写CSS代码。适用于单个元素的样式调整。…

css导航制作

css导航制作

水平导航栏制作 使用无序列表 <ul> 和 <li> 标签构建基础结构,通过 CSS 移除默认样式并设置横向排列: <ul class="horizontal-nav"…