Back to buttons

Live preview

Preview settings

Changes appear as you type. Use Tab to test keyboard focus.

⌘ / Ctrl + S saves locally

KhushiKhandelwal610's button

HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.

By @KhushiKhandelwal610

Remix button

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 KhushiKhandelwal610's button

KhushiKhandelwal610's button is an animated CSS button by @KhushiKhandelwal610. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.

Effects and categories
Hover effects, Toggle, Icon, Social
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" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Button</title>
		<!-- Remix icons -->
		<link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet" />
		<!-- Link to your stylesheet -->
		<link rel="stylesheet" href="./style.css" />
	</head>
	<body>
		<div class="wrapper">
			<button class="btn">
				<i class="ri-share-line"></i>
			</button>
			<ul class="list">
				<li class="item">
					<a href="#" class="link ig">
						<i class="ri-instagram-line"></i>
					</a>
				</li>
				<li class="item" style="--d: 0.25s">
					<a href="#" class="link tw">
						<i class="ri-twitter-line"></i>
					</a>
				</li>
				<li class="item" style="--d: 0.5s">
					<a href="#" class="link sc">
						<i class="ri-snapchat-line"></i>
					</a>
				</li>
			</ul>
		</div>

		<script>
			const btnEl = document.querySelector('.btn')
			const toggleOptions = () => {
				const wrapperEl = document.querySelector('.wrapper')
				const iconEl = btnEl.querySelector('i')

				wrapperEl.classList.toggle('active')

				if (iconEl.classList.contains('ri-share-line')) {
					iconEl.classList.replace('ri-share-line', 'ri-close-line')
				} else {
					iconEl.classList.replace('ri-close-line', 'ri-share-line')
				}
			}
			btnEl.addEventListener('click', toggleOptions)
		</script>
	</body>
</html>

CSS


@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');

/* General styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Poppins', sans-serif;
	background-color: #1a1d24;
	height: 100vh;
	display: grid;
	place-items: center;
}
a {
	text-decoration: none;
}
/* General styles end */
.wrapper {
	position: relative;
}
.wrapper :is(.btn, .link) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	background-color: #fff;
	color: #151515;
	border-radius: 50%;
}
.btn {
	position: absolute;
	border: none;
	cursor: pointer;
	z-index: 10;
}
.active .btn,
.btn:hover {
	outline: 3px solid #0561ee;
	outline-offset: -4px;
}
.item {
	position: absolute;
	list-style: none;
	transition: transform 0.5s;
	transition-delay: var(--d);
}
.wrapper.active .item:nth-child(1) {
	transform: translateX(-65px);
}
.wrapper.active .item:nth-child(2) {
	transform: translateY(-65px);
}
.wrapper.active .item:nth-child(3) {
	transform: translateX(65px);
}
.link:hover {
	color: #fff;
	transition: background-color 0.5s;
}
.ig:hover {
	background-image: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}
.tw:hover {
	background-color: #1da1f2;
}
.sc:hover {
	background-color: #fffc00;
	color: inherit;
}