Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
  <section>
    <div class="wrapper">
      <div class="polka-dot"></div>
      <div class="player-wrapper">
        <div class="player-container">
          <div class="player">
            <div class="cassete">
              <div class="rotator-container">
                <div class="cog left-cog">
                  <div class="chil1"></div>
                  <div class="chil2"></div>
                  <div class="cog-img"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28">
                      <path d="M23.9,13l4.1-2.3l-4.1-7.1l-4.1,2.3l-1.6-0.8V0.3H9.9v4.8L8.2,5.9L4.1,3.6L0,10.7L4.1,13V15L0,17.3l4.1,7.1l4.1-2.3l1.6,1
	v4.7h8.2v-4.7l1.6-1l4.1,2.3l4.1-7.1L23.9,15C23.9,15,23.9,13,23.9,13z M14,16.7c-1.5,0-2.6-1.2-2.6-2.6c0-1.5,1.2-2.6,2.6-2.6
	s2.6,1.2,2.6,2.6S15.5,16.7,14,16.7z" />
                    </svg></div>
                </div>

                <div class="cog right-cog">
                  <div class="chil1"></div>
                  <div class="chil2"></div>
                  <div class="cog-img"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28">
                      <path d="M23.9,13l4.1-2.3l-4.1-7.1l-4.1,2.3l-1.6-0.8V0.3H9.9v4.8L8.2,5.9L4.1,3.6L0,10.7L4.1,13V15L0,17.3l4.1,7.1l4.1-2.3l1.6,1
	v4.7h8.2v-4.7l1.6-1l4.1,2.3l4.1-7.1L23.9,15C23.9,15,23.9,13,23.9,13z M14,16.7c-1.5,0-2.6-1.2-2.6-2.6c0-1.5,1.2-2.6,2.6-2.6
	s2.6,1.2,2.6,2.6S15.5,16.7,14,16.7z" />
                    </svg></div>
                </div>
              </div>
            </div>
          </div>
          <div class="screws one"></div>
          <div class="screws two"></div>
          <div class="screws three"></div>
          <div class="screws four"></div>
          <div class="base">
            <div class="bottom-base"></div>
          </div>
        </div>
      </div>
      <div class="controls-container">
        <button class="btn play" onclick="bgmPlay()"></button>
        <button class="btn"></button>
        <button onclick="bgmStop()" class="btn"></button>
        <button class="btn"></button>
      </div>
    </div>
    <p>Designed By <a target="_blank" href="https://dribbble.com/inspired_monster"> Inspired Monster</a>&nbsp;&nbsp; | &nbsp;&nbsp;Coded by <a target="_blank" href="https://codepen.io/sankar254"> Sankar</a></p>
  </section>
  <audio id='player_audio' src='https://res.cloudinary.com/sankar254/video/upload/v1627034461/Music/bonjovi_short_gdsj4p.mp3' type="audio/mp3"></audio>
</body>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Lato:wght@300&display=swap');
* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Lato', sans-serif;
}
button {
  border: none;
}
body {
  background-color: #f3c74b;
}
section {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction:column;
}
p{
  font-size: 14px;
  margin-top: 30px;
  color:#612700;
  font-weight:bold;
}
a{
  color:#C80312;
  text-decoration:none;
}
.wrapper {
  min-width: 290px;
  min-height: 320px;
  background: rgb(19, 19, 27);
  background: linear-gradient(
    0deg,
    rgba(19, 19, 27, 1) 0%,
    rgba(40, 41, 46, 1) 100%
  );
  border-radius: 17px;
  display: flex;
  align-items: center;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding: 5px 15px;
}
.polka-dot {
  width: 180px;
  height: 23px;
  background-image: radial-gradient(circle, #161616 35%, transparent 9%),
    radial-gradient(circle, #161616 35%, transparent 9%);
  background-size: 10px 8px;
  background-position: 0 0, 0px 16px;
}
.player-wrapper {
  margin-top: 10px;
  width: 260px;
  height: 195px;
  background-color: #1d1e22;
  border-radius: 12px;
  padding: 5px;
}
.player-container {
  background: rgb(36, 39, 43);
  background: linear-gradient(
    128deg,
    rgba(36, 39, 43, 1) 0%,
    rgba(49, 50, 58, 1) 100%
  );
  height: 184px;
  height: 100%;
  border-radius: 8px;
  padding: 12px;
  position: relative;
}
.screws {
  width: 9px;
  height: 9px;
  position: absolute;
  top: 4px;
  left: 4px;
  border: 1px solid #1a1b1f;
  border-radius: 50%;
}
.screws:before {
  content: "";
  position: absolute;
  left: 1px;
  top: 3px;
  width: 5px;
  height: 1px;
  background-color: #1a1b1f;
}
.screws:after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 1px;
  height: 5px;
  background-color: #1a1b1f;
}
.player-container .screws.two {
  right: 4px;
  left: inherit;
}
.player-container .screws.three {
  bottom: 4px;
  top: inherit;
}
.player-container .screws.four {
  right: 4px;
  left: inherit;
  bottom: 4px;
  top: inherit;
}
.base {
  width: 167px;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 38px;
  clip-path: polygon(7% 0%, 93% 0%, 100% 100%, 0% 100%);
  box-shadow: inset 0px 2px 4px #000;
  overflow: hidden;
}
.base:before {
  content: "";
  position: absolute;
  left: -2px;
  bottom: 0;
  background-color: #000;
  width: 10px;
  height: 40px;
  transform: rotate(17deg);
  filter: blur(2px);
}
.base:after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -1px;
  background-color: #ffffff70;
  width: 11px;
  height: 39px;
  transform: rotate(343deg);
  filter: blur(1px);
}
.bottom-base {
  position: absolute;
  height: 13px;
  width: 47px;
  box-shadow: inset 1px 2px 3px #0f0f13;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
.player {
  background-color: #1b1b20;
  padding: 5px;
  height: 127px;
  position: relative;
  box-shadow: inset 0px 0px 5px rgba(0, 0, 0, 0.28);
}
.player:before {
  content: "";
  position: absolute;
  left: -11px;
  top: -5px;
  width: 20px;
  height: 10px;
  background-color: #25282c;
  transform: rotate(-45deg);
}
.player:after {
  content: "";
  position: absolute;
  right: -11px;
  top: -5px;
  width: 20px;
  height: 10px;
  background-color: #2d2e35;
  transform: rotate(227deg);
}
.cassete {
  height: 63px;
  background-color: #333338;
  box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  transform: translateY(38px);
  display: flex;
  justify-content: center;
  align-items: center;
}
.rotator-container {
  background-color: #0f1010;
  width: 103px;
  height: 43px;
  position: relative;
}
.rotator-container:before {
  content: "";
  position: absolute;
  top: -6px;
  left: -26px;
  background-color: rgba(187, 89, 85, 0.25);
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.left-cog {
  width: 32px;
  height: 32px;
  transform: translate(-14px, 6px);
  position: absolute;
  top: 0;
  left: -5px;
}
.right-cog {
  width: 32px;
  height: 32px;
  transform: translate(-14px, 6px);
  position: absolute;
  top: 0;
  right: -25px;
}
.right-cog:before {
  content: "";
  position: absolute;
  top: -30px;
  left: -24px;
  width: 92px !important;
  height: 92px !important;
  background-color: rgba(187, 89, 85, 0.25);
  border-radius: 50%;
}
.chil1 {
  background-color: #a8a8a8;
  width: 42px;
  height: 42px;
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 1;
  transform: translateY(-50%);
  border-radius: 50%;
}
.chil1:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 37px;
  height: 37px;
  background-color: #000;
  z-index: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.chil2 {
  background-color: #a8a8a8;
  width: 30px;
  height: 30px;
  position: absolute;
  top: 50%;
  left: 6px;
  z-index: 1;
  transform: translateY(-50%);
  border-radius: 50%;
}

.cog-img {
  position: absolute;
  top: 2px;
  left: 7px;
  z-index: 2;
  width: 28px;
  height: 28px;
}
.controls-container {
  width: 260px;
  height: 71px;
  background: rgb(28, 28, 33);
  background: linear-gradient(270deg, rgb(16 16 21) 0%, rgb(21 22 27) 100%);
  position: absolute;
  bottom: 0;
  left: 50%;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  transform: translateX(-50%);
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.btn {
  height: 64px;
  width: 62px;
  background: rgb(27, 28, 31);
  background: linear-gradient(
    0deg,
    rgba(27, 28, 31, 1) 0%,
    rgba(55, 56, 62, 1) 100%
  );
  border-right: 1px solid #1c1d20;
  cursor: pointer;
  position: relative;
}
.btn:first-child {
  border-top-left-radius: 8px;
}
.btn:last-child {
  border-top-right-radius: 7px;
}
.btn:active,
.btn.active {
  background: #191a1f;
  box-shadow: inset 4px 4px 5px rgba(0, 0, 0, 0.62);
}
.btn:active:before,
.btn:active:after {
  opacity: 0.3;
}
.btn:before,
.btn:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.5;
}
.btn:nth-child(1):before {
  width: 0px;
  height: 0px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 12px solid #fff;
}

.btn:nth-child(2):before {
  width: 0px;
  height: 0px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 12px solid #fff;
  transform: rotate(180deg) translate(13px, 9px);
}

.btn:nth-child(2):after {
  width: 0px;
  height: 0px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 12px solid #fff;
  transform: rotate(180deg) translate(1px, 9px);
}

.btn:nth-child(3):before {
  width: 15px;
  height: 15px;
  background: #fff;
}

.btn:nth-child(4):before {
  width: 0px;
  height: 0px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 12px solid #fff;
  transform: rotate(0deg) translate(-1px, -9px);
}

.btn:nth-child(4):after {
  width: 0px;
  height: 0px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 12px solid #fff;
  transform: rotate(0deg) translate(-13px, -9px);
}
@keyframes rotating {
  from {
    -webkit-transform: rotate(0deg);
  }
  to {
    -webkit-transform: rotate(360deg);
  }
}
.rotating {
  animation: rotating 3s linear infinite;
}

              
            
!

JS

              
                var bgm = document.getElementById("player_audio");
function bgmPlay() {
  bgm.play();
  $(".play").addClass("active");
  $(".cog-img").addClass("rotating");
  $(".stop").removeClass("active");
}
function bgmStop() {
  bgm.pause();
  bgm.currentTime = 0;
  $(".play").removeClass("active");
  $(".stop").addClass("active");
  $(".cog-img").removeClass("rotating");
}

              
            
!
999px

Console