Flexbox Music Player

In this example below you will see how to do a Flexbox Music Player with some HTML / CSS and Javascript

I used Ohans Emmanuel's free ebook "Understanding Flexbox" to create this music player.

Thumbnail
This awesome code was written by crystalespaillat, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright crystalespaillat ©

Technologies

  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Flexbox Music Player</title>
  
  
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Oswald:700'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <header>
  <ul>
    <li>
      CRYS <i class="fa fa-music"></i> TUNES</li>
    <li>
      <ul>
        <li><i class="fa fa-search"></i></li>
        <li><i class="fa fa-bars"></i></li>
      </ul>
    </li>
  </ul>
</header>

<main>
  <!-- CONTAINS PLAYLIST & SIDEBAR -->
  <aside>
    <i class="fa fa-volume-up"></i>
    <i class="fa fa-volume-down"></i>
    <i class="fa fa-home"></i>
    <i class="fa fa-user"></i>
    <i class="fa fa-cog"></i>
  </aside>

  <section class="content">
    <section class="musicHead">

      <img src="#" width="200px" height="200px">

      <div class="albumDetails">
        <h1>Top 100 Metal Squishy Songs</h1>
        <h2>Various Artists</h2>
        <h3> 2018. Charts. 100 songs.</h3>
      </div>

      <div class="musicControls">
        <i class="fa fa-play"></i> &nbsp; Play All 
        &nbsp; &nbsp;
        <i class="fa fa-plus"></i> &nbsp; Add To
      </div>

    </section>
    <!-- end musicHead -->
    <ul class="songList">
      <li>
        <p>Squishy Song #1</p>
        <p>Squishy Artist #1</p>
        <p>1:01</p>
        <p><span class="dl"><i class=" fa fa-arrow-down"></i> Download</span></p>
      </li>
      <li>
        <p>Squishy Song #2</p>
        <p>Squishy Artist #2</p>
        <p>2:02</p>
       <p><span class="dl"><i class=" fa fa-arrow-down"></i> Download</span></p>
      </li>
      <li>
        <p>Squishy Song #3</p>
        <p>Squishy Artist #3</p>
        <p>3:03</p>
  <p><span class="dl"><i class=" fa fa-arrow-down"></i> Download</span></p>
      </li>
      <li>
        <p>Squishy Song #4</p>
        <p>Squishy Artist #4</p>
        <p>4:04</p>
<p><span class="dl"><i class=" fa fa-arrow-down"></i> Download</span></p>
      </li>
    </ul>
  </section>
</main>

<footer>

</footer>
  <script src='https://use.fontawesome.com/3d833bdaaf.js'></script>

  

</body>

</html>

/*Downloaded from https://www.codeseek.co/crystalespaillat/flexbox-music-player-Nyvwzg */
html, body {
  height: 100%;
  margin: 0px;
}

h1 {
  font-size: 30px;
}

body {
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
}

header {
  background-color: black;
  flex: 0 0 10px;
  padding: 0px ;
  font-family: oswald;
  color: white;
}

header ul {
  display:flex;
  justify-content: space-between
}

header li {
  list-style: none;
  padding: 5px;
  margin-left: auto;
}

main {
  background-color: ;
  flex: 1 0 auto;
  display: flex;
}

aside {
  background-color: gainsboro;
  color: dimgray;
  font-size: 30px;
  flex: 0 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}

.content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.musicHead {
  display: flex;
  flex-direction: row;
  flex: 1 1 200px;
  justify-content: space-between;
  padding: 30px;
  height: 600px;
  background-color: #4E4E4E;
}

.albumDetails {
  align-self: stretch;
}

.musicControls {
  align-self: flex-end;
}

.songList li {
  list-style: none;
  display: flex;
  justify-content: space-around;
}

li:nth-child(2n) {
  background-color: #f2f2f2;
}

li span.dl {
  border: 1px black solid;
  padding: 2px;
  font-size: 0.7em;
}

footer {
  background-color: #0E0E0E;
  display: flex;
  flex: 0 0 90px;
  padding: 10px;
  color: white;
  font-family: oswald;
}

Comments