Simple CSS 3D Buttons

12/10/2020

Contents

Demo

Full Screen

Video

YouTube Channel

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Simple CSS 3D Buttons</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <div class="box">
        <h1>Simple CSS 3D Buttons</h1>
        <div class="buttons">
          <button class="button button-facebook" type="button" name="button"><i class="fab fa-facebook"></i>Facebook</button>
          <button class="button button-twitter" type="button" name="button"><i class="fab fa-twitter"></i>Twitter</button>
          <button class="button button-instagram" type="button" name="button"><i class="fab fa-instagram"></i>Instagram</button>
          <button class="button button-youtube" type="button" name="button"><i class="fab fa-youtube"></i>YouTube</button>
        </div>
      </div>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  background: #f7eedd;
}
.box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 280px;
  height: 280px;
  padding: 10px;
}
h1 {
  color: #4b1b2d;
  font-weight: 700;
  font-size: 1.5625rem;
}
.buttons {
  position: relative;
  width: 100%;
  height: 110px;
}
.button {
  width: 125px;
  height: 40px;
  border: none;
  border-radius: 4px;
  letter-spacing: 1px;
  color: #fff;
  font-size: 1rem;
  outline: none;
  cursor: pointer;
}
.fab {
  margin-right: 4px;
}
.button-facebook {
  position: absolute;
  top: 0;
  left: 0;
  box-shadow: 0 8px 0 0 #283c6f;
  background: #1877f2;
}
.button-twitter {
  position: absolute;
  top: 0;
  right: 0;
  box-shadow: 0 8px 0 0 #355183;
  background: #1da1f2;
}
.button-instagram {
  position: absolute;
  top: 60px;
  left: 0;
  box-shadow: 0 8px 0 0 #a1092d;
  background: #f26939;
}
.button-youtube {
  position: absolute;
  top: 60px;
  right: 0;
  box-shadow: 0 8px 0 0 #9e0000;
  background: #da1725;
}
.button-facebook:hover,
.button-twitter:hover,
.button-instagram:hover,
.button-youtube:hover {
  transform: translateY(8px);
  box-shadow: 0 0 0 0;
}