Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Mario button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Nishusk
Button submission checks
Checks will appear after the preview updates.
Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.
Accessibility quick check
Waiting for the rendered preview…
Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.
Explore freely here. Remix to publish your version with credit to the creator.
About Mario button
Mario button is an animated CSS button by @Nishusk. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Animated
- Using this example
- Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.
Usage, Tailwind and licensing questions
Read the source files
HTML
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Mario button</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<button class="button" type="button">
<img class="button-image" src="https://assets.codepen.io/4175254/mario.png" alt="" />
<span>Mario</span>
</button>
<button class="button" type="button">
<img class="button-image" src="https://assets.codepen.io/4175254/luigi.png" alt="" />
<span>Luigi</span>
</button>
<!-- partial -->
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
@font-face {
font-family: "Seurat";
src: url("https://assets.codepen.io/4175254/FOT-Seurat+Pro+DB.otf") format("opentype");
}
body {
display: flex;
justify-content: center;
align-items: center;
column-gap: 12px;
min-height: 100vh;
font-family: "Seurat", sans-serif;
}
.button {
all: unset;
display: flex;
justify-content: center;
align-items: center;
column-gap: 0.5em;
position: relative;
border-radius: 50px;
padding: 16px 24px;
background-color: #f0f7fa;
box-shadow: inset 0 -4px 8px #87bfd8, 0 4px 6px rgba(0, 0, 0, 0.2);
cursor: pointer;
color: #0470e3;
transition: transform 0.4s cubic-bezier(0.55, 1, 0.15, 1);
will-change: transform;
}
.button:active {
transform: scale(0.92);
}
.button:active::after {
opacity: 1;
}
.button::after {
content: "";
position: absolute;
inset: 0;
border-image-source: url("https://assets.codepen.io/4175254/mario-button-borders.png");
border-image-slice: 50%;
border-image-width: 40px;
border-style: solid;
transform: scale(1.04, 1.08);
opacity: 0;
transition-property: opacity;
transition-duration: 0.4s;
transition-timing-function: cubic-bezier(0.55, 1, 0.15, 1);
will-change: transform;
}
.button:focus-visible::after {
opacity: 1;
animation: pulsate 1s infinite;
}
.button-image {
width: 1.75em;
height: 1.75em;
object-fit: contain;
}
@keyframes pulsate {
0% {
transform: scale(1.04, 1.08);
}
50% {
transform: scale(1.08, 1.12);
}
100% {
transform: scale(1.04, 1.08);
}
}JavaScript
// Add Your button script here