制作一个简单版QQ音乐网站首页代码
时间: 2024-01-05 16:17:56 浏览: 183
以下是一个简单版QQ音乐网站首页的HTML和CSS代码:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>QQ音乐</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="logo">
<img src="logo.png" alt="QQ音乐">
</div>
<nav>
<ul>
<li><a href="#">音乐馆</a></li>
<li><a href="#">MV</a></li>
<li><a href="#">榜单</a></li>
<li><a href="#">歌手</a></li>
<li><a href="#">专辑</a></li>
</ul>
</nav>
<div class="search">
<input type="text" placeholder="搜索音乐、MV、歌词、电台">
<button>搜索</button>
</div>
</header>
<main>
<section class="recommend">
<h2>为你推荐</h2>
<ul>
<li>
<a href="#">
<img src="recommend1.jpg" alt="推荐1">
<h3>推荐1</h3>
</a>
</li>
<li>
<a href="#">
<img src="recommend2.jpg" alt="推荐2">
<h3>推荐2</h3>
</a>
</li>
<li>
<a href="#">
<img src="recommend3.jpg" alt="推荐3">
<h3>推荐3</h3>
</a>
</li>
<li>
<a href="#">
<img src="recommend4.jpg" alt="推荐4">
<h3>推荐4</h3>
</a>
</li>
</ul>
</section>
<section class="news">
<h2>新闻公告</h2>
<ul>
<li><a href="#">新闻1</a></li>
<li><a href="#">新闻2</a></li>
<li><a href="#">新闻3</a></li>
<li><a href="#">新闻4</a></li>
</ul>
</section>
</main>
<footer>
<p>版权所有 © QQ音乐</p>
</footer>
</body>
</html>
```
```css
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
header {
background-color: #000;
color: #fff;
padding: 10px;
display: flex;
align-items: center;
}
.logo img {
height: 50px;
}
nav ul {
list-style: none;
display: flex;
margin: 0;
padding: 0;
}
nav li {
margin-right: 20px;
}
nav a {
color: #fff;
text-decoration: none;
}
.search {
margin-left: auto;
display: flex;
align-items: center;
}
.search input {
padding: 5px;
border: none;
border-radius: 5px;
margin-right: 10px;
}
.search button {
padding: 5px 10px;
background-color: #fff;
border: none;
border-radius: 5px;
color: #000;
cursor: pointer;
}
main {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
display: flex;
flex-wrap: wrap;
}
section {
flex: 1;
margin-right: 20px;
}
section h2 {
margin-top: 0;
}
section ul {
list-style: none;
margin: 0;
padding: 0;
}
section li {
margin-bottom: 10px;
}
section a {
color: #000;
text-decoration: none;
}
section img {
width: 100%;
height: auto;
border-radius: 5px;
}
```
阅读全文