写一个音乐网站框架只用css和html
时间: 2024-02-15 18:02:57 浏览: 139
以下是一个简单的音乐网站框架,仅使用HTML和CSS实现:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>My Music Website</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<h1>My Music Website</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Genres</a></li>
<li><a href="#">Artists</a></li>
<li><a href="#">Playlists</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section class="featured">
<h2>Featured Songs</h2>
<ul>
<li>
<img src="song1.jpg" alt="Song 1">
<h3>Song 1</h3>
<p>Artist 1</p>
</li>
<li>
<img src="song2.jpg" alt="Song 2">
<h3>Song 2</h3>
<p>Artist 2</p>
</li>
<li>
<img src="song3.jpg" alt="Song 3">
<h3>Song 3</h3>
<p>Artist 3</p>
</li>
</ul>
</section>
<section class="genres">
<h2>Genres</h2>
<ul>
<li><a href="#">Pop</a></li>
<li><a href="#">Rock</a></li>
<li><a href="#">Hip Hop</a></li>
<li><a href="#">Electronic</a></li>
<li><a href="#">Jazz</a></li>
</ul>
</section>
<section class="artists">
<h2>Artists</h2>
<ul>
<li><a href="#">Artist 1</a></li>
<li><a href="#">Artist 2</a></li>
<li><a href="#">Artist 3</a></li>
<li><a href="#">Artist 4</a></li>
<li><a href="#">Artist 5</a></li>
</ul>
</section>
<section class="playlists">
<h2>Playlists</h2>
<ul>
<li><a href="#">Playlist 1</a></li>
<li><a href="#">Playlist 2</a></li>
<li><a href="#">Playlist 3</a></li>
<li><a href="#">Playlist 4</a></li>
<li><a href="#">Playlist 5</a></li>
</ul>
</section>
</main>
<footer>
<p>© 2021 My Music Website. All rights reserved.</p>
</footer>
</body>
</html>
```
CSS代码:
```
/* Reset styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
/* Header styles */
header {
background-color: #333;
color: #fff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 10px 20px;
}
nav ul {
display: flex;
flex-direction: row;
list-style-type: none;
}
nav li {
margin-right: 20px;
}
nav a {
color: #fff;
text-decoration: none;
}
/* Main styles */
main {
display: flex;
flex-direction: column;
padding: 20px;
}
section {
margin-bottom: 30px;
}
h2 {
margin-bottom: 10px;
}
ul {
display: flex;
flex-direction: row;
list-style-type: none;
flex-wrap: wrap;
}
li {
margin-right: 20px;
}
img {
max-width: 100%;
}
h3, p {
margin-top: 10px;
}
/* Footer styles */
footer {
background-color: #333;
color: #fff;
padding: 10px 20px;
text-align: center;
}
```
这个框架包括了一个顶部导航栏,以及几个主要的部分(特色歌曲、音乐类型、艺术家、播放列表),并且使用了flex布局来使页面看起来更加美观。
阅读全文