帮我写一个小米网站首页的代码
时间: 2023-08-28 07:12:35 浏览: 197
好的,下面是一个简单的小米网站首页的代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>小米官网</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
/* 样式表 */
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.logo {
font-size: 32px;
font-weight: bold;
margin-right: auto;
}
.nav {
display: flex;
align-items: center;
margin-left: auto;
}
.nav li {
list-style: none;
margin: 0 10px;
}
.nav li a {
color: #333;
text-decoration: none;
font-size: 16px;
}
.nav li a:hover {
color: #ff6700;
}
.hero {
background-image: url('https://cdn.pixabay.com/photo/2018/01/29/20/51/background-3115191_960_720.jpg');
background-size: cover;
background-position: center center;
height: 500px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
color: #fff;
}
.hero h1 {
font-size: 48px;
font-weight: bold;
margin: 0;
line-height: 1.2;
}
.hero p {
font-size: 24px;
margin: 20px 0 0;
}
.cta {
display: flex;
align-items: center;
justify-content: center;
margin-top: 30px;
}
.cta button {
background-color: #ff6700;
color: #fff;
font-size: 24px;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
transition: all 0.2s ease-in-out;
}
.cta button:hover {
background-color: #ff7800;
}
.features {
background-color: #f5f5f5;
padding: 50px 20px;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.feature {
flex-basis: 300px;
margin: 20px;
text-align: center;
}
.feature i {
font-size: 48px;
color: #ff6700;
margin-bottom: 20px;
}
.feature h2 {
font-size: 24px;
margin: 0;
font-weight: bold;
color: #333;
}
.feature p {
font-size: 16px;
margin: 10px 0 0;
color: #666;
}
.footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
.footer p {
margin: 0;
}
.footer a {
color: #fff;
text-decoration: none;
}
@media only screen and (max-width: 768px) {
/* 响应式样式 */
.container {
flex-direction: column;
}
.logo {
margin: 0;
margin-bottom: 20px;
}
.nav {
margin: 0;
margin-bottom: 20px;
}
.hero {
height: 300px;
}
.hero h1 {
font-size: 32px;
}
.hero p {
font-size: 18px;
}
.feature {
flex-basis: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="logo">小米</div>
<ul class="nav">
<li><a href="#">首页</a></li>
<li><a href="#">手机</a></li>
<li><a href="#">电视</a></li>
<li><a href="#">笔记本</a></li>
<li><a href="#">家电</a></li>
<li><a href="#">路由器</a></li>
<li><a href="#">智能硬件</a></li>
<li><a href="#">服务</a></li>
<li><a href="#">社区</a></li>
</ul>
</div>
<div class="hero">
<h1>小米10T Pro</h1>
<p>更快速的速度,更多惊喜</p>
<div class="cta">
<button>立即购买</button>
</div>
</div>
<div class="features">
<div class="feature">
<i class="fa fa-mobile" aria-hidden="true"></i>
<h2>手机</h2>
<p>超高性价比,体验卓越</p>
</div>
<div class="feature">
<i class="fa fa-television" aria-hidden="true"></i>
<h2>电视</h2>
<p>领先科技,出色画质</p>
</div>
<div class="feature">
<i class="fa fa-laptop" aria-hidden="true"></i>
<h2>笔记本</h2>
<p>轻薄便携,高性能</p>
</div>
<div class="feature">
<i class="fa fa-home" aria-hidden="true"></i>
<h2>家电</h2>
<p>智能家居,更加舒适</p>
</div>
<div class="feature">
<i class="fa fa-wifi" aria-hidden="true"></i>
<h2>路由器</h2>
<p>稳定快速,覆盖全面</p>
</div>
<div class="feature">
<i class="fa fa-gears" aria-hidden="true"></i>
<h2>智能硬件</h2>
<p>多样化的智能设备,为您服务</p>
</div>
</div>
<div class="footer">
<p>©2021 小米公司 版权所有</p>
<p><a href="#">联系我们</a> | <a href="#">加入我们</a> | <a href="#">法律声明</a></p>
</div>
</body>
</html>
```
注意:这只是一个简单的代码示例,实际情况下可能需要更多的页面元素和样式,也需要更加完善的交互效果。
阅读全文