How To Create Music App Design In HTML And CSS

Blue and White Modern Corporate Business YouTube Thumbnail 1

Here, you will able to learn about how to make a UI design for music player just using HTML AND CSS ONLY.

I have used neumorphic design in this session, you can use other design patterns, shape, size and color for improving your skills.

At the end of this session i have use basic JavaScript for adding a small effect to this music player.

HTML Code

Use divs with classes and provide a great skeleton to your html file.

Below is HTML file Code.

<div class="phone">
  <div class="inner">
    <div class="header">
      <button class="button back">
        <i class="fa fa-long-arrow-left"></i>
      </button>
      <h2 class="title">My Playlist</h2>
      <button class="button more">
        <i class="fa fa-share-alt"></i>
      </button>
    </div>
    
    <div class="cover" id="cover">
      <img id="rotate" src="disk-rotate.jpg">
    </div>
    <div class="disk" id="disk">
      <img id="stop" src="disk-rotate.jpg">
    </div>
    
    <div class="info">
      <h3 class="song">Sober Up</h3>
      <h4 class="artist">AJR/Rviers Cuomo</h4>
    </div>
    
    <div class="time">
      <div class="bar"></div>
    </div>
    
    <div class="control">
      <button class="control-button prev">
        <i class="fa fa-step-backward"></i>
      </button>
      <button class="play-button play" onclick="myFunction()">
        <i class="fa fa-play" id="play"></i>
        <i class="fa fa-pause" id="pause"></i>
      </button>
      <button class="control-button forward">
        <i class="fa fa-step-forward"></i>
      </button>
    </div>
    
  </div>
</div> 

CSS Code

Use CSS to create a beautiful design.

Below is CSS file Code. 

 

body {
  background-color: #e5edf2;
}

.footer {
  text-align: center;
}

a {
  color: #8f95a4;
}

.phone {
  width: 375px;
  height: 100%;
  background-color: #f1f8fd;
  position: relative;
  border-radius: 40px;
  margin: 30px auto;
  box-shadow: 20px 20px 30px 0 rgba(0,0,0,0.1);
}

.phone::after {
  content: '';
  width: 135px;
  height: 6px;
  background-color: #c8d4dd;
  border-radius: 3px;
  display: block;
  position: absolute;
  bottom: 9px;
  left: 50%;
  margin-left: -67.5px;
}

.inner {
  padding: 40px 24px 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  align-self: stretch;
  display: flex;
  justify-content: space-between;
}

.title {
  margin: 0;
  line-height: 32px;
  font-size: 16px;
  color: #222e51;
}

.button {
  width: 32px;
  height: 32px;
  background-color: #f1f8fd;
  padding: 8px;
  border-radius: 8px;
  border: none;
  outline: none;
  cursor: pointer;
  color: #222e51;
  box-shadow:
    6px 6px 6px rgba(0,0,0,0.05),
    -6px -6px 6px rgba(255,255,255,0.6),
    inset 2px 2px 5px rgba(0,0,0,0.03),
    inset -2px -2px 5px rgba(255,255,255,0.4);
  transition: all 0.3s;
}

.button:hover {
  box-shadow:
    6px 6px 6px rgba(0,0,0,0.05),
    -6px -6px 6px rgba(255,255,255,0.6),
    inset 3px 3px 3px rgba(0,0,0,0.03),
    inset -3px -3px 3px rgba(255,255,255,0.4);
}

.button:active {
  box-shadow:
    6px 6px 6px rgba(0,0,0,0.05),
    -6px -6px 6px rgba(255,255,255,0.6),
    inset 8px 8px 8px rgba(0,0,0,0.05),
    inset -8px -8px 8px rgba(255,255,255,0.6);
}

.cover,.disk {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  margin: 15px 0 15px 0;
  overflow: hidden;
  border: 3px solid #f1f8fd;
  box-shadow:
    20px 20px 20px rgba(0,0,0,0.07),
    -20px -20px 20px rgba(255,255,255,0.7),
    6px 6px 6px rgba(0,0,0,0.09),
    -6px -6px 6px rgba(255,255,255,0.9);
}

.cover::after, .disk::after {
  content: '';
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background-color: #f1f8fd;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -27.5px 0 0 -27.5px;
  box-shadow:
    inset 5px 5px 5px rgba(0,0,0,0.07),
    inset -5px -5px 5px rgba(255,255,255,0.7);
}

.cover img, .disk img  {
  width: 100%;
  height: 100%;
}

.info {
  text-align: center;
  margin-bottom: 15px;
}

.info .song {
  margin: 0 0 16px 0;
  line-height: 24px;
  font-size: 24px;
  color: #222e51;
}

.info .artist {
  margin: 0;
  line-height: 16px;
  font-size: 16px;
  font-weight: normal;
  color: #8f95a4;
}

.time {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  box-shadow:
    9px 9px 9px rgba(0,0,0,0.05),
    -9px -9px 9px rgba(255,255,255,0.5),
    inset 4px 4px 4px rgba(0,0,0,0.05),
    inset -4px -4px 4px rgba(255,255,255,0.5);
  margin-bottom: 15px;
}

.time .bar {
  width: 80%;
  height: 12px;
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 6px;
  background-color: #8f95a4;
  box-shadow:
    2px 2px 2px rgba(0,0,0,0.05),
    -2px -2px 2px rgba(255,255,255,0.5),
    inset 3px 3px 3px rgba(255,255,255,0.5),
    inset -3px -3px 3px rgba(0,0,0,0.05);
}

.control {
  padding: 0 40px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-button {
  cursor: pointer;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: none;
  outline: none;
  margin: 0;
  padding: 0;
}

.play-button {
  cursor: pointer;
  position: relative;
  background-color: transparent;
  border: none;
  outline: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: block;
  transition: all 0.3s;
  box-shadow:
    9px 9px 9px rgba(0,0,0,0.06),
    -9px -9px 9px rgba(255,255,255,0.6),
    inset 5px 5px 5px rgba(0,0,0,0.07),
    inset -5px -5px 5px rgba(255,255,255,0.7);
}

.play-button::before {
  content: '';
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: #8f95a4;
  top: 50%;
  left: 50%;
  margin: -35px 0 0 -35px;
  box-shadow:
    inset 3px 3px 3px rgba(255,255,255,0.5),
    inset -3px -3px 3px rgba(0,0,0,0.05);
}

.play-button:hover::before {
  box-shadow:
    inset 3px 3px 3px rgba(255,255,255,0.35),
    inset -3px -3px 3px rgba(0,0,0,0.035);
}

.play-button:active::before {
  box-shadow:
    inset 3px 3px 3px rgba(0,0,0,0.05),
    inset -3px -3px 3px rgba(255,255,255,0.5);
}

.play-button i {
  position: relative;
  left: 3px;
}

.prev i,
.forward i {
  color: #8f95a4;
  font-size: 40px;
}
.play i {
  color: #fefefe;
  font-size: 30px;
}





.cover {
  -webkit-animation: spin 2s linear infinite;
  -moz-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
  -webkit-transition: all 500ms;
  -moz-transition: all 500ms;
  transition: all 500ms;
}


@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}
@-moz-keyframes spin {
  0% {
    -moz-transform: rotate(0deg);
  }
  100% {
    -moz-transform: rotate(360deg);
  }
}
@keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
.cover {
  display: none;
}
#pause {
  display: none;
}
 

Optional (basic javascript code for effect)

function myFunction() {
  var a = document.getElementById("cover");
  var b = document.getElementById("disk");
  var c = document.getElementById("pause");
  var d = document.getElementById("play");
  if (a.style.display === "none" && c.style.display === "none") {
    a.style.display = "block";
    b.style.display = "none";
    c.style.display = "block";
    d.style.display = "none";
  } else {
  	a.style.display = "none";
    b.style.display = "block";
    c.style.display = "none";
    d.style.display = "block";
  }
} 

Watch Below Video for Detail Understanding

Leave a Reply

Your email address will not be published. Required fields are marked *