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

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Minimal Button</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="button-container">
        <button class="minimal-button"><span>Click me</span>
            <div class="fill-animation"></div>
            <div class="color-layer red"></div>
            <div class="color-layer green"></div>
            <div class="color-layer blue"></div>
            <div class="color-layer orange"></div>
            <div class="color-layer purple"></div>
            <div class="color-layer indigo"></div>
            <div class="color-layer yellow"></div>
        </button>
    </div>
</body>
</html>

              
            
!

CSS

              
                /* General page styles */
body {
    background-color: #081f5c; /* Page background color */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif; /* Font family */
}

/* Button container */
.button-container {
    text-align: center;
}

/* Minimal button styles */
.minimal-button {
    position: relative;
    font-size: 16px; /* Font size */
    padding: 10px 20px;
    color: white; /* Normal text color */
    background-color: transparent; /* Normal button background */
    border: 2px solid white; /* Border color */
    cursor: pointer;
    overflow: hidden; /* Ensures overflow content is hidden */
    text-decoration: none; /* Remove underline */
    display: inline-block;
    position: relative;
    transition: transform 0.3s ease; /* Smooth transform effect */
}

.minimal-button span {
    position: relative;
    z-index: 3; /* Ensures text is above the hover effects */
    display: inline-block;
    transition: color 0.3s ease; /* Smooth color transition */
}

/* Fill animation */
.fill-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: white; /* Fill color */
    z-index: 1;
    transition: width 1s ease;
}

.minimal-button:hover .fill-animation {
    width: 100%;
}

/* Color layers */
.color-layer {
    position: absolute;
    top: 0;
    left: 1;
    width: 0;
    height: 100%;
    z-index: 0;
}

.red { background-color: red; }
.green { background-color: green; }
.blue { background-color: blue; }
.orange { background-color: orange; }
.purple { background-color: purple; }
.indigo { background-color: indigo; }
.yellow { background-color: yellow; }

.minimal-button:hover .red {
    animation: slideRed 0.8s linear forwards;
}
.minimal-button:hover .green {
    animation: slideGreen 0.7s linear forwards 0.8s;
}
.minimal-button:hover .blue {
    animation: slideBlue 0.6s linear forwards 1.5s;
}
.minimal-button:hover .orange {
    animation: slideOrange 0.5s linear forwards 2.1s;
}
.minimal-button:hover .purple {
    animation: slidePurple 0.4s linear forwards 2.6s;
}
.minimal-button:hover .indigo {
    animation: slideIndigo 0.3s linear forwards 3s;
}
.minimal-button:hover .yellow {
    animation: slideYellow 0.2s linear forwards 3.3s;
}

/* Slide animations */
@keyframes slideRed {
    to { width: 100%; }
}
@keyframes slideGreen {
    to { width: 100%; }
}
@keyframes slideBlue {
    to { width: 100%; }
}
@keyframes slideOrange {
    to { width: 100%; }
}
@keyframes slidePurple {
    to { width: 100%; }
}
@keyframes slideIndigo {
    to { width: 100%; }
}
@keyframes slideYellow {
    to { width: 100%; }
}

/* Text color change on hover */
.minimal-button:hover span {
    color: black; /* Text color on hover */
}

/* Button sink animation on click */
.minimal-button:active {
    transform: translateY(2px);
}

/* Reverse animation on hover out */
.minimal-button:not(:hover) .fill-animation,
.minimal-button:not(:hover) .color-layer {
    width: 0;
    transition: width 1s ease;
}

              
            
!

JS

              
                
              
            
!
999px

Console