我需要一段用Html、Css、Javascript来实现一个房屋租房平台的前端设计代码
时间: 2023-06-09 15:02:46 浏览: 155
好的,下面我会提供一份简单的HTML、CSS和JavaScript代码来实现房屋租赁平台的前端设计:
HTML代码:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>租房平台</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#">主页</a></li>
<li><a href="#">房源</a></li>
<li><a href="#">关于我们</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</nav>
</header>
<main>
<section class="search-area">
<h1>找到你想要的房间</h1>
<form>
<input type="text" placeholder="城市">
<input type="text" placeholder="区域">
<input type="text" placeholder="价格">
<button>搜索</button>
</form>
</section>
<section class="properties">
<h2>可用房源</h2>
<div class="property">
<img src="house1.jpg" alt="房源1">
<h3>三室一厅</h3>
<p>位于南京,靠近地铁站,适合家庭居住</p>
<span class="price">5000元/月</span>
</div>
<div class="property">
<img src="house2.jpg" alt="房源2">
<h3>一室一厅</h3>
<p>位于上海市中心,周围环境便利,交通便捷</p>
<span class="price">3000元/月</span>
</div>
<div class="property">
<img src="house3.jpg" alt="房源3">
<h3>两室一厅</h3>
<p>位于北京市,临近商业中心,购物方便</p>
<span class="price">4000元/月</span>
</div>
</section>
</main>
<footer>
<p>© 2021 All Rights Reserved</p>
</footer>
</body>
</html>
```
CSS代码:
```
body {
font-family: Arial, sans-serif;
margin: 0;
}
header {
background-color: #333;
color: #fff;
padding: 20px;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-right: 20px;
}
nav li:last-child {
margin-right: 0;
}
nav a {
color: #fff;
text-decoration: none;
font-size: 18px;
}
main {
max-width: 1200px;
margin: 0 auto;
padding: 50px;
}
.search-area {
text-align: center;
margin-bottom: 50px;
}
.search-area h1 {
margin-top: 0;
}
.search-area input {
padding: 10px;
margin-right: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
.search-area button {
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
.properties {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.property {
margin-bottom: 40px;
width: 30%;
}
.property img {
width: 100%;
border-radius: 5px;
}
.property h3 {
margin-top: 10px;
margin-bottom: 5px;
}
.property p {
font-size: 14px;
line-height: 18px;
margin: 0;
}
.property .price {
font-size: 18px;
font-weight: bold;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 20px;
}
```
JavaScript代码:
```
// 暂时不需要任何JavaScript,可以扩展其他功能
```
阅读全文