Material design buttons
How do I make an material design buttons?
Script automatically adds the material design effect to elements with 'material-design' class. Can also be used on div with images. Add the preferred color as value of the 'data-color' attribute.. What is a material design buttons? How do you make a material design buttons? This script and codes were developed by Michaela on 27 July 2022, Wednesday.
Material design buttons - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Material design buttons</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(http://fonts.googleapis.com/css?family=Open+Sans:300);
* { box-sizing: border-box; outline: none;
}
body { font-family: 'Open Sans'; font-size: 100%; font-weight: 300; line-height: 1.5em; text-align: center;
}
h1 { color: #666666; font-size: 2rem; line-height: 1.5em; margin: 2em 0 2em 0;
}
.box { margin: 1rem; width: 18.75rem;
}
.box img { width: 100%;
}
.btn { border: none; color: white; overflow: hidden; margin: 1rem; padding: 0; text-transform: uppercase; width: 150px; height: 40px;
}
.btn.color-1 { background-color: #426FC5;
}
.btn.color-2 { background-color: #00897b;
}
.btn.color-3 { background-color: #f6774f;
}
.btn.color-4 { background-color: #e94043;
}
.btn-border.color-1 { background-color: transparent; border: 2px solid #426FC5; color: #426FC5;
}
.btn-border.color-2 { background-color: transparent; border: 2px solid #00897b; color: #00897b;
}
.btn-border.color-3 { background-color: transparent; border: 2px solid #f6774f; color: #f6774f;
}
.btn-border.color-4 { background-color: transparent; border: 2px solid #e94043; color: #e94043;
}
.btn-round { border-radius: 10em;
}
.material-design { position: relative;
}
.material-design canvas { opacity: 0.25; position: absolute; top: 0; left: 0;
}
.container { align-content: center; align-items: flex-start; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; margin: 0 auto; max-width: 46rem;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>Material Design Buttons</h1>
<section class="container"> <button class="btn color-1 material-design" data-color="#2f5398">Press me!</button> <button class="btn color-2 material-design" data-color="#004740">Press me!</button> <button class="btn color-3 material-design" data-color="#f34711">Press me!</button> <button class="btn color-4 material-design" data-color="#d2181c">Press me!</button> <button class="btn btn-round color-1 material-design" data-color="#ffffff">Senden</button> <button class="btn btn-round color-2 material-design" data-color="#ffffff">Senden</button> <button class="btn btn-round color-3 material-design" data-color="#ffffff">Senden</button> <button class="btn btn-round color-4 material-design" data-color="#ffffff">Senden</button> <button class="btn btn-border color-1 material-design" data-color="#2f5398">Senden</button> <button class="btn btn-border color-2 material-design" data-color="#004740">Senden</button> <button class="btn btn-border color-3 material-design" data-color="#f34711">Senden</button> <button class="btn btn-border color-4 material-design" data-color="#d2181c">Senden</button> <button class="btn btn-border btn-round color-1 material-design" data-color="#426FC5">Senden</button> <button class="btn btn-border btn-round color-2 material-design" data-color="#00897b">Senden</button> <button class="btn btn-border btn-round color-3 material-design" data-color="#f6774f">Senden</button> <button class="btn btn-border btn-round color-4 material-design" data-color="#e94043">Senden</button>
</section> <script src="js/index.js"></script>
</body>
</html>
Material design buttons - Script Codes CSS Codes
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300);
* { box-sizing: border-box; outline: none;
}
body { font-family: 'Open Sans'; font-size: 100%; font-weight: 300; line-height: 1.5em; text-align: center;
}
h1 { color: #666666; font-size: 2rem; line-height: 1.5em; margin: 2em 0 2em 0;
}
.box { margin: 1rem; width: 18.75rem;
}
.box img { width: 100%;
}
.btn { border: none; color: white; overflow: hidden; margin: 1rem; padding: 0; text-transform: uppercase; width: 150px; height: 40px;
}
.btn.color-1 { background-color: #426FC5;
}
.btn.color-2 { background-color: #00897b;
}
.btn.color-3 { background-color: #f6774f;
}
.btn.color-4 { background-color: #e94043;
}
.btn-border.color-1 { background-color: transparent; border: 2px solid #426FC5; color: #426FC5;
}
.btn-border.color-2 { background-color: transparent; border: 2px solid #00897b; color: #00897b;
}
.btn-border.color-3 { background-color: transparent; border: 2px solid #f6774f; color: #f6774f;
}
.btn-border.color-4 { background-color: transparent; border: 2px solid #e94043; color: #e94043;
}
.btn-round { border-radius: 10em;
}
.material-design { position: relative;
}
.material-design canvas { opacity: 0.25; position: absolute; top: 0; left: 0;
}
.container { align-content: center; align-items: flex-start; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; margin: 0 auto; max-width: 46rem;
}
Material design buttons - Script Codes JS Codes
var canvas = {}, centerX = 0, centerY = 0, color = '', containers = document.getElementsByClassName('material-design') context = {}, element = {}, radius = 0, requestAnimFrame = function () { return ( window.requestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); } ); } (), init = function () { containers = Array.prototype.slice.call(containers); for (var i = 0; i < containers.length; i += 1) { canvas = document.createElement('canvas'); canvas.addEventListener('click', press, false); containers[i].appendChild(canvas); canvas.style.width ='100%'; canvas.style.height='100%'; canvas.width = canvas.offsetWidth; canvas.height = canvas.offsetHeight; } }, press = function (event) { color = event.toElement.parentElement.dataset.color; element = event.toElement; context = element.getContext('2d'); radius = 0; centerX = event.offsetX; centerY = event.offsetY; context.clearRect(0, 0, element.width, element.height); draw(); }, draw = function () { context.beginPath(); context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false); context.fillStyle = color; context.fill(); radius += 2; if (radius < element.width) { requestAnimFrame(draw); } };
init();
Developer | Michaela |
Username | Fischaela |
Uploaded | July 27, 2022 |
Rating | 4.5 |
Size | 4,381 Kb |
Views | 72,864 |
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!
Name | Size |
News reading experiment | 6,961 Kb |
Material design buttons | 4,381 Kb |
IPad app prototype template | 2,396 Kb |
Projects geildanke with new animations | 6,186 Kb |
Profile page scibble | 3,692 Kb |
Geildanke team | 4,153 Kb |
Geildanke typography | 3,249 Kb |
Geildanke products | 5,250 Kb |
Geildanke buttons | 3,154 Kb |
WebGL Template for ThreeJS | 2,713 Kb |
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!
Name | Username | Size |
IbrahimJabbari-Effect14 | Ibrahimjabbari | 1,919 Kb |
Simple blog concept | Drew_mc | 2,666 Kb |
We Simplify animation | Meodai | 48,169 Kb |
Ready-to-Go Three-columns Responsive Typography Template with Off-Canvas Navigation | Englishextra | 18,977 Kb |
Myprofile | SoufianeAbid | 2,451 Kb |
Scarlett Johansson Tribute Page | Diomed | 3,233 Kb |
SVG Circle Progress | JMChristensen | 3,368 Kb |
Responsive Pricing Table | Jeremycaris | 2,690 Kb |
Simple Login Form Template | Banunn | 3,571 Kb |
Confirm Close Of Foundation Reveal Modal | Winghouchan | 1,818 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!