Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

Save Automatically?

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

              
                <div class="container">
    <div class="oval-container">
      <div class="nokia3310">
        <div class="nokia-head-container">
          <div class="speaker">
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
          </div>
          <div class="logo">NOKIA</div>
          <div class="screen-container">
            <span>NOKIA 3310</span>
          </div>
          <div class="bottom-oval">
            <div class="big button top"></div>
          </div>
        </div>
        <div class="bottom-buttons">
          <div class="big button left">
            <span>C</span>
          </div>
          <div class="big button right">
            <span>&lt;</span>
            <span>&gt;</span>
          </div>
        </div>
        <div class="keyboard">
          <div class="button-key-container">
            <div class="button-key left">
              <span class="special">1</span>
              <span class="minitext compact">o_o</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key middle">
              <span class="special">2</span>
              <span class="minitext">abc</span>
            </div>
          </div>
          <div class="button-key-container invert">
            <div class="button-key right">
              <span class="special">3</span>
              <span class="minitext">def</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key left">
              <span class="special">4</span>
              <span class="minitext">ghi</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key middle">
              <span class="special">5</span>
              <span class="minitext">jkl</span>
            </div>
          </div>
          <div class="button-key-container invert">
            <div class="button-key right">
              <span class="special">6</span>
              <span class="minitext">mno</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key left">
              <span class="special">7</span>
              <span class="minitext">pqrs</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key middle">
              <span class="special">8</span>
              <span class="minitext">tuv</span>
            </div>
          </div>
          <div class="button-key-container invert">
            <div class="button-key right">
              <span class="special">9</span>
              <span class="minitext">wxyz</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key left">
              <span class="special">*</span>
              <span class="minitext">+</span>
            </div>
          </div>
          <div class="button-key-container">
            <div class="button-key middle">
              <span class="special">0</span>
              <span class="minitext rotate">[</span>
            </div>
          </div>
          <div class="button-key-container invert">
            <div class="button-key right">
              <span class="special">#</span>
              <span class="minitext home"></span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="down">
    <button>Encender</button>
  </div>

<div class="created">
  <span>Created by</span>
  <a href="https://manz.dev/"><h2>Manz.dev</h2></a>
  <p>on <a href="https://twitch.tv/ManzDev">Twitch</a> / <a href="https://youtu.be/w3sVve42kBQ">Youtube</a></p>
</div>
              
            
!

CSS

              
                @use postcss-nested;

@font-face {
  font-family: "Conthrax SB";
  src:
    url(https://manzdev.github.io/twitch-nokia3310/conthrax-sb.woff2) format("woff2"),
    url(https://manzdev.github.io/twitch-nokia3310/conthrax-sb.woff) format("woff"),
    url(https://manzdev.github.io/twitch-nokia3310/conthrax-sb.ttf) format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Nokia Cellphone FC";
  src:
    url(https://manzdev.github.io/twitch-nokia3310/nokia-cellphone-fc.woff2) format("woff2"),
    url(https://manzdev.github.io/twitch-nokia3310/nokia-cellphone-fc.woff) format("woff"),
    url(https://manzdev.github.io/twitch-nokia3310/nokia-cellphone-fc.ttf) format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Rubber Nipple Factory";
  src:
    url(https://manzdev.github.io/twitch-nokia3310/rubber-nipple-factory.woff2) format("woff2"),
    url(https://manzdev.github.io/twitch-nokia3310/rubber-nipple-factory.woff) format("woff"),
    url(https://manzdev.github.io/twitch-nokia3310/rubber-nipple-factory.ttf) format("truetype");
  font-display: swap;
}

:root {
  --nokia-bgcolor: #3f3d46;
  --nokia-radius-shape: 16% 16% 14% 14% / 31% 31% 54% 54%; /* Monkyja */
  --nokia-logo-font: "Conthrax SB";
  --nokia-phone-font: "Nokia Cellphone FC";
  --nokia-number-font: "Rubber Nipple Factory";
}

body {
  transition: background 1s;
}

body.dark {
  background: #222;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 90vh;
}

.down {
  display: flex;
  justify-content: center;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes on {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-50px); }
}

@keyframes glow {
  0% { filter: drop-shadow(0 0 5px cyan); }
  100% { filter: drop-shadow(0 0 15px cyan); }
}

.nokia3310 {
  width: 170px;
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--nokia-bgcolor);
  background-image:
    linear-gradient(to right, #0005 15%, transparent),
    linear-gradient(
      111deg,
      #2f2b31,
      #7d8299
    );
  box-shadow:
    0 0 8px 4px #0006,
    0 0 8px 4px #0005 inset;
  border-radius: var(--nokia-radius-shape);
  position: relative;

  &.rotate {
    animation: rotate 5s ease-in-out infinite;
  }

  &.on {
    animation:
      on 2.5s ease-in-out infinite,
      glow 2.5s ease-in-out infinite alternate;

    & div.screen-container {
      background: #88c792;
      filter: drop-shadow(0 0 6px #88c792);

      & span {
        opacity: 1;
      }
    }
  }

  & .nokia-head-container {
    width: 90%;
    height: 61%;
    border-radius: 25% 25% 60% 60% / 40% 40% 50% 50%;
    transform: translateY(5px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    box-shadow:
      0 6px 0 #ddd inset,
      -8px -16px 0 #ddd inset,
      -12px -16px 0 #aaa inset,
      8px -16px 0 #ddd inset,
      12px -16px 0 #eee inset;

    & .speaker {
      box-shadow:
        6px 0 8px #aaa3 inset,
        -2px 0 6px #000a inset;
      margin-top: 8px;
      margin-bottom: 3px;
      border-radius: 50%;
      width: 9px;
      height: 40px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-around;
      padding: 2px 0;

      & .hole {
        background: #000;
        width: 4px;
        height: 2px;
        border-radius: 50%;
        box-shadow: 0 0 2px #0009;
      }
    }

    & .logo {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 55px;
      height: 15px;
      font-family: var(--nokia-logo-font);
      font-size: 12px;
      color: #dfdfda;
      background: #111;
      margin-bottom: 8px;
      border-left: 1px solid #444;
      border-right: 1px solid #444;
    }

    & .screen-container {
      display: flex;
      justify-content: center;
      align-items: center;
      background: #78a47f;
      width: 106px;
      height: 78px;
      border-radius: 8px / 10px 10px 35px 35px;
      border: 1px solid #000a;
      border-top: 2px solid #000a;
      box-shadow:
        0 0 8px #000 inset,
        -4px 0 2px #fff8,
        4px 0 2px #2228;
      font-family: var(--nokia-phone-font);
      font-size: 12px;
      color: #2e4434;
      transition: filter 0.5s, background 1s;

      & span {
        opacity: 0;
        transition: opacity 1s;
      }
    }

    & .bottom-oval {
      margin-top: auto;
      width: 100%;
      height: 50px;
      background: #ddd;
      border-radius: 60%;
      display: flex;
      flex-direction: column;
      align-items: center;

      & .big.button {
        &.top {
          background: #ddd;
          background-image: linear-gradient(110deg, #ddd, #aaa);
          border: 2px solid #000a;
          width: 75px;
          height: 20px;
          border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
          transform: translateY(-4px);
          display: flex;
          justify-content: center;

          &::before {
            content: "";
            display: block;
            width: 30px;
            height: 4px;
            border: 4px solid #2992a1;
            border-radius: 50%;
            transform: translateY(1px);
            clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
          }
        }
      }
    }
  }

  & .bottom-buttons {
    width: 80%;
    display: flex;
    justify-content: space-between;
    position: absolute;

    & .big.button {
      position: relative;
      transform: translateY(200px);

      &.left {
        background: #ccc;
        background-image: linear-gradient(to bottom, #ddd 55%, #aaa);
        border: 2px solid #000a;
        width: 40px;
        height: 20px;
        border-radius: 31px 11px 11px 21px / 22px 20px 20px;
        transform: translate(5px, 189px) rotate(36deg);
        overflow: hidden;

        & span {
          font-family: var(--nokia-number-font);
          font-size: 12px;
          display: block;
          transform: rotate(-35deg) translate(10px, 3px);
        }

        &::after {
          content: "";
          background-color: #eee;
          height: 100%;
          width: 100%;
          border-radius: 50%;
          position: absolute;
          transform: translateY(-100%);
          z-index: -1;
        }
      }

      &.right {
        background: #ddd;
        background-image: linear-gradient(to bottom, #ddd 55%, #aaa);
        border: 2px solid #000a;
        width: 55px;
        height: 25px;
        border-radius: 7px 48px 36px 30px / 5px 16px 11px 15px;
        transform: translateY(189px) rotate(-34deg) skew(-12deg);
        display: flex;
        justify-content: space-around;
        overflow: hidden;

        &::after {
          content: "";
          background-color: #eee;
          height: 100%;
          width: 100%;
          border-radius: 50%;
          position: absolute;
          transform: translateY(-50%);
          z-index: -1;
        }

        & span {
          font-family: var(--nokia-phone-font);
          font-size: 12px;
          display: block;
          transform: translate(0, 4px);
        }
      }
    }
  }

  & .keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 6px;
    width: 85%;
    height: 110px;
    margin-top: 8px;

    & .button-key-container {
      font-family: var(--nokia-number-font);
      font-weight: bold;
      font-size: 14px;

      &.invert .button-key .special {
        order: 2;
      }

      /* Left */
      &:nth-child(1) { transform: translate(-1px, -5px); }
      &:nth-child(4) { transform: translate(2px, -2px); }
      &:nth-child(7) { transform: translate(5px, 1px); }
      &:nth-child(10) { transform: translate(8px, 4px); }

      /* Middle */
      &:nth-child(2) { transform: translate(1px, 0); }
      &:nth-child(5) { transform: translate(1px, 3px); }
      &:nth-child(8) { transform: translate(1px, 6px); }
      &:nth-child(11) { transform: translate(1px, 9px); }

      /* Right */
      &:nth-child(3) { transform: translate(2px, -5px); }
      &:nth-child(6) { transform: translate(-1px, -2px); }
      &:nth-child(9) { transform: translate(-4px, 1px); }
      &:nth-child(12) { transform: translate(-7px, 4px); }

      & .button-key {
        display: flex;
        justify-content: center;
        position: relative;
        z-index: 0;
        user-select: none;

        &:active {
          cursor: pointer;
          transform: translateY(1px);

          &.middle {
            transform: translateY(6px);
          }

          &::before {
            box-shadow: 0 2px 0 #0004;
          }
        }

        &.left .minitext { transform: translate(0, 3px); }

        &.left::before {
          --rotation: 15deg;

          border-radius: 33% 67% 43% 36% / 58% 72% 28% 42%;
        }
        &.middle { transform: translateY(5px); }
        &.middle::before { border-radius: 48% 52% 50% 50% / 40% 40% 60% 60%; }

        &.right::before {
          --rotation: -15deg;

          border-radius: 67% 33% 36% 43% / 72% 58% 42% 28%;
        }

        &::before {
          --y: -5px;

          content: "";
          display: block;
          width: 37px;
          height: 20px;
          position: absolute;
          background: #dedee0;
          background-image: linear-gradient(#dedee0, #aaa);
          border-radius: 50%;
          border: 2px solid #000c;
          box-shadow: 0 0 3px #0004;
          z-index: -1;
          transform: translateY(var(--y, 0)) rotate(var(--rotation, 0));
        }

        & span {
          font-family: var(--nokia-phone-font);
          font-size: 8px;
          font-weight: lighter;
          color: #111;

          &.special {
            font-weight: bolder;
            font-size: 10px;
            color: #000;
          }

          &.minitext.rotate {
            display: block;
            transform: translateX(4px) rotate(-90deg);
          }

          &.minitext {
            transform: translateY(4px);
          }
        }
      }
    }

    & .home {
      border: 1px solid #000;
      border-top: 0;
      width: 4px;
      height: 4px;
      margin-right: 2px;
      margin-top: 2px;
      display: block;

      &::before,
      &::after {
        content: "";
        display: block;
        width: 1px;
        height: 5px;
        border-left: 1px solid #000;
        position: absolute;
        transform: translate(0, -3px) rotate(45deg);
      }

      &::after {
        transform: translate(3px, -4px) rotate(-45deg);
      }
    }

    & .compact {
      letter-spacing: -4px;
    }
  }
}

button {
  font-family: var(--nokia-phone-font);
  text-shadow: 0 1px 0 #000;
  background: #375dda;
  color: #fff;
  border: 0;
  padding: 5px 15px;
  border-radius: 10px;
  box-shadow: 0 4px 0 #2044b9;

  &:disabled {
    color: #888;
    background: #555;
    box-shadow: 0 4px 0 #444;
  }

  &:active {
    transform: translateY(2px);
    background: #1c3895;
    box-shadow: 0 2px 0 #2044b9;
  }
}

.created {
  background: 
    url(https://assets.codepen.io/154065/internal/avatars/users/default.png),
    linear-gradient(to bottom, #884ced, #ec1cce);
  background-size: 75px 75px, cover;
  background-repeat: no-repeat;
  position: absolute;
  top: 0;
  right: 0;
  width: 250px;
  height: 75px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 2em;
  
  & span,
  & h2,
  & p,
  & a {
    font-family: Montserrat;
    margin: 0;
  }
  
  & a,
  & p,
  & span {
    color: #fff;    
  }
  
  & h2 {
    font-weight: 700;
    transform: translate(0, -4px);    
  }
  
  & a {
    text-decoration-color: rgba(255,255,255,0.4);
  }
  
  & a:hover {
    color: #e6e82a;
  }
}
              
            
!

JS

              
                const nokia3310 = document.querySelector(".nokia3310");
const button = document.querySelector("button");
const audio = new Audio("https://manzdev.github.io/twitch-nokia3310/music.mp3");

button.addEventListener("click", () => {
  document.body.classList.add("dark");
  nokia3310.classList.add("on");
  audio.play();
  button.disabled = true;
});
              
            
!
999px

Console