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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- google font -->
  <link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Noto+Sans+TC:wght@400;500;700&display=swap" rel="stylesheet">
  <!-- Font-awsome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
  </link>
  <!-- animate -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.0/animate.min.css" />
</head>

<body>
  <div class="wrap">
    <div class="header">
      <h1>Black&White Buttons</h1>
      <p>Hover us and enjoy the satisfying animation designs!</p>
    </div>
    <ul class="list">
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
      <li><a href="#">Read More</a></li>
    </ul>
  </div>
</body>

</html>
              
            
!

CSS

              
                * {
  padding: 0;
  margin: 0;
  list-style: none;
  line-height: 1.5em;
  letter-spacing: 0.1em;
  box-sizing: border-box;
  font-family: "Lato", "Noto Sans TC", sans-serif;
}

a {
  text-decoration: none;
  color: #000;
}

body {
  width: 100%;
  height: 100%;
  background-color: #e0e5ec;
}

.wrap {
  max-width: 1024px;
  margin: 0 auto 10%;
}

.header {
  text-align: center;
  margin: 5% 0;
}

.header h1 {
  font-size: 40px;
  margin-bottom: 1%;
}

.header p {
  color: #606060;
}

.list {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.list li {
  width: 15%;
  position: relative;
  transition: 0.5s;
}

.list li:nth-child(n + 7) {
  margin-top: 5%;
}

.list li:nth-child(13),
.list li:nth-child(18) {
  opacity: 0;
}

.list li:nth-child(5),
.list li:nth-child(6),
.list li:nth-child(7),
.list li:nth-child(8),
.list li:nth-child(n + 13) {
  background-color: #000;
}

.list li:nth-child(5) a,
.list li:nth-child(6) a,
.list li:nth-child(7) a,
.list li:nth-child(8) a,
.list li:nth-child(n + 13) a {
  color: #fff;
}

.list li a {
  display: block;
  padding: 5% 0;
  text-align: center;
  border: 2px solid #000;
  transition: 0.5s;
}

@media (max-width: 768px) {
  .list {
    justify-content: space-around;
  }
  .list li {
    width: 45%;
  }
  .list li:nth-child(n + 3) {
    margin-top: 10%;
  }
  .list li:nth-child(13),
  .list li:nth-child(18) {
    display: none;
  }
  .header h1 {
    font-size: 24px;
    margin-bottom: 10%;
  }
  .header p {
    display: none;
  }
}
/* Num 1 */

.list li:nth-child(1):hover {
  box-shadow: 5px 5px 5px #aaa, -5px -5px 5px #fff;
}
/* Num 2 */

.list li:nth-child(2)::before {
  content: "";
  width: 90%;
  height: 60%;
  border: 1px solid #000;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  z-index: -1;
  transition: 0.5s;
  opacity: 0;
}

.list li:nth-child(2):hover::before {
  opacity: 1;
}
/* Num 3 */

.list li:nth-child(3)::before,
.list li:nth-child(3)::after {
  content: "";
  width: 0;
  height: 0;
  position: absolute;
  transition: 0.5s;
  opacity: 0;
}

.list li:nth-child(3)::before {
  border-top: 4px solid #000;
  border-left: 4px solid #000;
  top: 0;
  left: 0;
}

.list li:nth-child(3)::after {
  border-bottom: 4px solid #000;
  border-right: 4px solid #000;
  bottom: 0;
  right: 0;
}

.list li:nth-child(3):hover:before,
.list li:nth-child(3):hover::after {
  width: 96%;
  height: 88%;
  opacity: 1;
}
/* Num 4 */

.list li:nth-child(4) a:hover {
  border: 2px solid transparent;
}

.list li:nth-child(4) a::before,
.list li:nth-child(4) a::after {
  content: "";
  width: 0;
  height: 0;
  position: absolute;
  transition: 0.5s;
}

.list li:nth-child(4) a::before {
  border-top: 6px solid #000;
  border-right: 6px solid transparent;
  top: 1px;
  left: 1px;
}

.list li:nth-child(4) a::after {
  border-bottom: 6px solid #000;
  border-left: 6px solid transparent;
  bottom: 1px;
  right: 1px;
}

.list li:nth-child(4) a:hover:before,
.list li:nth-child(4) a:hover::after {
  width: 100%;
  height: 100%;
  border: 2px solid #000;
}
/* Num 5 */

.list li:nth-child(5):hover {
  box-shadow: 5px 5px 5px #aaa, -5px -5px 5px #fff;
  background-color: transparent;
}

.list li:nth-child(5):hover a {
  color: #000;
  border: 2px solid transparent;
}

.list li:nth-child(5) a::before,
.list li:nth-child(5) a::after {
  content: "";
  width: 0;
  height: 2px;
  background-color: #000;
  position: absolute;
  transition: 1s;
}

.list li:nth-child(5) a::before {
  top: 0;
  right: 0;
}

.list li:nth-child(5) a::after {
  bottom: 0;
  left: 0;
}

.list li:nth-child(5):hover a::before,
.list li:nth-child(5):hover a::after {
  width: 100%;
}
/* Num 6 */

.list li:nth-child(6):hover {
  background-color: transparent;
}

.list li:nth-child(6)::before,
.list li:nth-child(6)::after {
  content: "";
  width: 0;
  height: 2px;
  background-color: #000;
  position: absolute;
  transition: 0.8s;
}

.list li:nth-child(6)::before {
  top: 0;
  left: 0;
}

.list li:nth-child(6)::after {
  bottom: 0;
  right: 0;
}

.list li:nth-child(6):hover:before,
.list li:nth-child(6):hover::after {
  width: 100%;
}

.list li:nth-child(6):hover a {
  color: #000;
  border: 2px solid transparent;
}

.list li:nth-child(6) a::before,
.list li:nth-child(6) a::after {
  content: "";
  width: 2px;
  height: 0;
  background-color: #000;
  position: absolute;
  transition: 0.6s;
}

.list li:nth-child(6) a::before {
  bottom: 0;
  left: 0;
}

.list li:nth-child(6) a::after {
  top: 0;
  right: 0;
}

.list li:nth-child(6) a:hover:before,
.list li:nth-child(6) a:hover::after {
  height: 100%;
}
/* Num 7 */

.list li:nth-child(7) {
  overflow: hidden;
}

.list li:nth-child(7):hover {
  background-color: transparent;
}

.list li:nth-child(7):hover a {
  color: #000;
  border: 2px solid transparent;
}

.list li:nth-child(7) a::before,
.list li:nth-child(7) a::after {
  content: "";
  width: 100%;
  height: 50%;
  background-color: #000;
  position: absolute;
  left: 0;
  transition: 0.5s;
  opacity: 0;
}

.list li:nth-child(7) a::before {
  top: 0;
}

.list li:nth-child(7) a::after {
  bottom: 0;
}

.list li:nth-child(7) a:hover:before {
  top: -50%;
  opacity: 1;
}

.list li:nth-child(7) a:hover::after {
  bottom: -50%;
  opacity: 1;
}
/* Num 8 */

.list li:nth-child(8) {
  perspective: 300px;
  transform-style: preserve-3d;
}

.list li:nth-child(8):hover {
  background-color: transparent;
}

.list li:nth-child(8):hover a {
  color: #000;
}

.list li:nth-child(8)::after {
  content: "";
  width: 98%;
  height: 100%;
  background-color: #000;
  position: absolute;
  transform-origin: center bottom;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  transition: 0.5s;
  transform: rotateX(0);
  z-index: -1;
}

.list li:nth-child(8):hover:after {
  transform: rotateX(-180deg);
  bottom: 1px;
}
/* Num 9 */

.list li:nth-child(9) {
  overflow: hidden;
}

.list li:nth-child(9) a:hover {
  color: #fff;
}

.list li:nth-child(9)::before {
  content: "";
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    #e0e5ec 25%,
    #000 25%,
    #000 75%,
    #e0e5ec 25%
  );
  position: absolute;
  top: 0;
  transition: 0.5s;
  z-index: -1;
  opacity: 0;
}

.list li:nth-child(9):hover::before {
  transform: rotate(180deg);
  background: linear-gradient(0deg, #000 25%, #000 25%, #000 75%, #000 25%);
  opacity: 1;
}
/* Num 10 */

.list li:nth-child(10)::before {
  content: "";
  width: 100%;
  height: 100%;
  background-color: #000;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  transition: 0.5s;
  transform: scale(0);
}

.list li:nth-child(10):hover:before {
  transform: scale(1);
}

.list li:nth-child(10) a:hover {
  color: #fff;
}
/* Num 11 */

.list li:nth-child(11) {
  overflow: hidden;
}

.list li:nth-child(11):hover {
  background-color: #000;
}

.list li:nth-child(11)::before {
  content: "";
  width: 100%;
  height: 90%;
  background-color: rgba(255, 255, 255, 0.5);
  position: absolute;
  z-index: -1;
  top: 5%;
  left: 0;
  animation: flash 3s linear infinite;
}

@keyframes flash {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scaleX(5);
    left: 50%;
    opacity: 1;
  }
  100% {
    transform: scaleX(10);
    left: 100%;
    opacity: 0;
  }
}

.list li:nth-child(11) a:hover {
  color: #fff;
  position: relative;
  z-index: 2;
}
/* Num 12 */

.list li:nth-child(12) {
  overflow: hidden;
}

.list li:nth-child(12):hover a {
  border: 2px solid transparent;
  color: #e0e5ec;
}

.list li:nth-child(12)::after {
  content: "So Sad";
  color: #fff;
  width: 100%;
  height: 100%;
  background-color: #000;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: 0.5s;
  cursor: pointer;
}

.list li:nth-child(12):hover::after {
  transform: translateY(-100%) scale(1.5);
  opacity: 1;
}
/* Num 14 */

.list li:nth-child(14)::before,
.list li:nth-child(15)::before,
.list li:nth-child(16)::before,
.list li:nth-child(17)::before {
  content: "";
  background-color: #e0e5ec;
  position: absolute;
  transition: 0.5s;
  z-index: 0;
}

.list li:nth-child(14)::before {
  width: 96%;
  height: 0;
  bottom: 5%;
  left: 2%;
}

.list li:nth-child(14):hover:before {
  top: 2px;
  height: 90%;
}

.list li:nth-child(14) a:hover,
.list li:nth-child(15) a:hover,
.list li:nth-child(16) a:hover,
.list li:nth-child(17) a:hover {
  color: #000;
  position: relative;
  z-index: 1;
}
/* Num 15 */

.list li:nth-child(15)::before {
  width: 96%;
  height: 0;
  top: 5%;
  left: 2%;
}

.list li:nth-child(15):hover:before {
  top: auto;
  bottom: 2px;
  height: 90%;
}
/* Num 16 */

.list li:nth-child(16)::before {
  width: 0;
  height: 90%;
  top: 5%;
  right: 2%;
}

.list li:nth-child(16):hover:before {
  top: auto;
  bottom: 2px;
  right: auto;
  left: 2px;
  width: 96%;
}
/* Num 17 */

.list li:nth-child(17)::before {
  width: 0;
  height: 90%;
  top: 5%;
  left: 2%;
}

.list li:nth-child(17):hover:before {
  top: auto;
  bottom: 2px;
  left: auto;
  right: 2px;
  width: 96%;
}

              
            
!

JS

              
                
              
            
!
999px

Console