用html写一个好看的UI界面,使用合适的颜色和样式修饰。并添加适当的内容
时间: 2024-04-04 09:32:27 浏览: 26
好的,以下是一个简单的HTML页面代码,包含一个漂亮的UI界面和一些内容。请注意,这只是一个示例,您可以根据自己的需要进行修改和添加。
```html
<!DOCTYPE html>
<html>
<head>
<title>好看的UI界面</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
margin: 0;
}
.container {
max-width: 960px;
margin: 0 auto;
padding: 20px;
}
h1 {
color: #333;
text-align: center;
margin-top: 50px;
}
.navbar {
background-color: #333;
color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
}
.navbar ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
.navbar li {
margin-right: 20px;
}
.navbar li:last-child {
margin-right: 0;
}
.navbar a {
color: #fff;
text-decoration: none;
font-size: 18px;
}
.hero {
background-image: url('https://cdn.pixabay.com/photo/2015/09/09/16/05/forest-931706_960_720.jpg');
background-size: cover;
background-position: center;
height: 500px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
text-align: center;
}
.hero h2 {
font-size: 40px;
margin-bottom: 20px;
}
.hero p {
font-size: 20px;
}
.features {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 50px;
}
.feature {
background-color: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
width: calc(33.33% - 20px);
margin-bottom: 20px;
padding: 20px;
text-align: center;
}
.feature h3 {
font-size: 24px;
margin-bottom: 10px;
}
.feature p {
font-size: 16px;
margin-bottom: 0;
}
.cta {
background-color: #333;
color: #fff;
padding: 50px;
text-align: center;
margin-top: 50px;
}
.cta h2 {
font-size: 40px;
margin-bottom: 20px;
}
.cta p {
font-size: 20px;
margin-bottom: 20px;
}
.cta button {
background-color: #fff;
color: #333;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<header class="navbar">
<a href="#">Logo</a>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</header>
<div class="hero">
<h2>Welcome to our website</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus lacus vel vehicula sagittis.</p>
</div>
<div class="container">
<h1>Our Features</h1>
<div class="features">
<div class="feature">
<h3>Feature 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus lacus vel vehicula sagittis.</p>
</div>
<div class="feature">
<h3>Feature 2</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus lacus vel vehicula sagittis.</p>
</div>
<div class="feature">
<h3>Feature 3</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus lacus vel vehicula sagittis.</p>
</div>
</div>
</div>
<div class="cta">
<h2>Get started today</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus lacus vel vehicula sagittis.</p>
<button>Sign up now</button>
</div>
</body>
</html>
```
这个页面包含一个导航栏、一个漂亮的主页区域、三个特点区域和一个叫做“CTA”的呼吁行动部分。你可以在样式中自定义颜色和样式,使其适合你的品牌和需求。