Slanty Button Mixin

Developer
Size
4,109 Kb
Views
12,144

How do I make an slanty button mixin?

A button with slanted borders, and a slanty fill. The slanty bits are made from CSS gradients. Use the mixin and make one for yourself.. What is a slanty button mixin? How do you make a slanty button mixin? This script and codes were developed by Eli Fitch on 28 October 2022, Friday.

Slanty Button Mixin Previews

Slanty Button Mixin - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Slanty Button Mixin</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import url(https://fonts.googleapis.com/css?family=Lato:400,700);
.fancy-button { background-repeat: no-repeat; background-image: linear-gradient(-60deg, #ff4cff 0%, #ff4cff 41.6%, #5bf390 41.6%, #5bf390 100%), linear-gradient(-60deg, #ff4cff 0%, #ff4cff calc(100% - 41.6%), #5bf390 calc(100% - 41.6%), #5bf390 100%); background-position: 0 0, 0 100%, 0 0, 100% 0; background-size: 100% 0.3em, 100% 0.3em, calc(100% + 0.6em) 100%, 100% calc(100% + 0.6em); border: none; border-left: 0.3em solid #5bf390; border-right: 0.3em solid #ff4cff; padding: 1em 1.5em; overflow: hidden; position: relative; font-size: 1em; margin-bottom: 1em; transition: all 0.4s;
}
.fancy-button:hover:before, .fancy-button:hover:after, .fancy-button:active:before, .fancy-button:active:after { transform: translateX(0);
}
.fancy-button:before, .fancy-button:after { content: ''; display: block; position: absolute; z-index: -1; width: 100%; height: 100%; top: 0; left: 0; background-repeat: no-repeat; background-size: 100% calc(100% - 0.6em); background-position: 50% 0.3em; transition: all 0.4s;
}
.fancy-button:before { background-image: linear-gradient(-60deg, transparent 0%, transparent 50%, #5bf390 50%, #5bf390 100%); transform: translateX(calc(-100% + 41.6%));
}
.fancy-button:after { background-image: linear-gradient(120deg, transparent 0%, transparent 50%, #ff4cff 50%, #ff4cff 100%); transform: translateX(calc(100% - 41.6%));
}
.fancy-button:hover { color: white;
}
html { font-size: 30px; font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif; padding: 1em; text-align: center;
}
button { appearance: none; background-color: transparent; border: none; font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif; outline: none !important;
}
h4 { margin-bottom: 1em;
}
h6 { font-size: 0.6em;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h4>A button with slanted borders, and a slanty fill. The slanty bits are made from CSS gradients.<br>Use the mixin and make one for yourself!
</h4>
<button class="fancy-button">Hover me, baby</button>
<h6>
Relies on a magic number, if you're smarter than me and can figure out how to get rid of that, then you get a 

Slanty Button Mixin - Script Codes CSS Codes

@import url(https://fonts.googleapis.com/css?family=Lato:400,700);
.fancy-button { background-repeat: no-repeat; background-image: linear-gradient(-60deg, #ff4cff 0%, #ff4cff 41.6%, #5bf390 41.6%, #5bf390 100%), linear-gradient(-60deg, #ff4cff 0%, #ff4cff calc(100% - 41.6%), #5bf390 calc(100% - 41.6%), #5bf390 100%); background-position: 0 0, 0 100%, 0 0, 100% 0; background-size: 100% 0.3em, 100% 0.3em, calc(100% + 0.6em) 100%, 100% calc(100% + 0.6em); border: none; border-left: 0.3em solid #5bf390; border-right: 0.3em solid #ff4cff; padding: 1em 1.5em; overflow: hidden; position: relative; font-size: 1em; margin-bottom: 1em; transition: all 0.4s;
}
.fancy-button:hover:before, .fancy-button:hover:after, .fancy-button:active:before, .fancy-button:active:after { transform: translateX(0);
}
.fancy-button:before, .fancy-button:after { content: ''; display: block; position: absolute; z-index: -1; width: 100%; height: 100%; top: 0; left: 0; background-repeat: no-repeat; background-size: 100% calc(100% - 0.6em); background-position: 50% 0.3em; transition: all 0.4s;
}
.fancy-button:before { background-image: linear-gradient(-60deg, transparent 0%, transparent 50%, #5bf390 50%, #5bf390 100%); transform: translateX(calc(-100% + 41.6%));
}
.fancy-button:after { background-image: linear-gradient(120deg, transparent 0%, transparent 50%, #ff4cff 50%, #ff4cff 100%); transform: translateX(calc(100% - 41.6%));
}
.fancy-button:hover { color: white;
}
html { font-size: 30px; font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif; padding: 1em; text-align: center;
}
button { appearance: none; background-color: transparent; border: none; font-family: 'Lato', 'brandon grotesque', 'gotham', futura, helvetica, sans-serif; outline: none !important;
}
h4 { margin-bottom: 1em;
}
h6 { font-size: 0.6em;
}
Slanty Button Mixin - Script Codes
Slanty Button Mixin - Script Codes
Home Page Home
Developer Eli Fitch
Username elifitch
Uploaded October 28, 2022
Rating 4.5
Size 4,109 Kb
Views 12,144
Do you need developer help for Slanty Button Mixin?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Eli Fitch (elifitch) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!