写一个旅游app的网页设计的代码,用html和css
时间: 2024-05-16 08:12:21 浏览: 84
以下是一个简单的旅游app网页设计的代码示例,使用HTML和CSS:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Travel App</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<h1>Travel App</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Destinations</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section class="intro">
<h2>Discover Your Next Adventure</h2>
<p>Find amazing destinations and plan your perfect trip with our travel app.</p>
<button>Get Started</button>
</section>
<section class="destinations">
<h2>Popular Destinations</h2>
<div class="destination">
<img src="https://via.placeholder.com/150" alt="Destination Image">
<h3>New York City</h3>
<p>From $200/night</p>
<button>Book Now</button>
</div>
<div class="destination">
<img src="https://via.placeholder.com/150" alt="Destination Image">
<h3>Paris</h3>
<p>From $250/night</p>
<button>Book Now</button>
</div>
<div class="destination">
<img src="https://via.placeholder.com/150" alt="Destination Image">
<h3>Tokyo</h3>
<p>From $300/night</p>
<button>Book Now</button>
</div>
</section>
<section class="about">
<h2>About Our App</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nibh ut feugiat dictum, enim augue pharetra magna, eget placerat neque felis sed tellus. Nullam ut aliquam nunc.</p>
<button>Learn More</button>
</section>
</main>
<footer>
<p>© 2021 Travel App</p>
</footer>
</body>
</html>
```
CSS代码:
```
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
}
nav ul {
list-style: none;
display: flex;
}
nav li {
margin: 0 10px;
}
nav a {
color: #fff;
text-decoration: none;
font-weight: bold;
}
main {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.intro {
text-align: center;
margin-bottom: 50px;
}
.intro h2 {
font-size: 36px;
margin-bottom: 20px;
}
.intro p {
font-size: 18px;
margin-bottom: 40px;
}
.intro button {
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
.destinations {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
margin-bottom: 50px;
}
.destination {
background-color: #f2f2f2;
padding: 20px;
margin-bottom: 20px;
flex-basis: calc(33.33% - 20px);
text-align: center;
}
.destination img {
max-width: 100%;
margin-bottom: 20px;
}
.destination h3 {
font-size: 24px;
margin-bottom: 10px;
}
.destination p {
font-size: 18px;
margin-bottom: 20px;
}
.destination button {
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
.about {
text-align: center;
margin-bottom: 50px;
}
.about h2 {
font-size: 36px;
margin-bottom: 20px;
}
.about p {
font-size: 18px;
margin-bottom: 40px;
}
.about button {
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
footer {
background-color: #f2f2f2;
padding: 10px 20px;
text-align: center;
}
```
这个示例网页包括一个顶部导航菜单,一个介绍部分,一个目的地部分和一个关于部分。使用flexbox布局,自适应不同的屏幕尺寸。
阅读全文