mirror of
https://github.com/uiverse-io/galaxy.git
synced 2025-11-28 05:00:22 +08:00
87 lines
No EOL
1.5 KiB
HTML
87 lines
No EOL
1.5 KiB
HTML
<button class="button">
|
|
<div class="icon_cont">
|
|
<span class="icon">🡪</span>
|
|
</div>
|
|
<span class="text_button">Hover this button</span>
|
|
</button>
|
|
|
|
<style>
|
|
/* From Uiverse.io by MuhammadHasann - Tags: simple, icon, minimalist, button */
|
|
.button {
|
|
--dark: #181818;
|
|
--light: #d9d9d9;
|
|
--active: 0;
|
|
|
|
cursor: pointer;
|
|
position: relative;
|
|
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
|
|
transform-origin: center;
|
|
|
|
background-color: transparent;
|
|
|
|
border: none;
|
|
}
|
|
|
|
.button:hover {
|
|
--active: 1;
|
|
}
|
|
|
|
.icon_cont {
|
|
overflow: clip;
|
|
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
|
|
width: calc(var(--active) * 1.5rem + (1 - var(--active)) * 0.5rem);
|
|
height: calc(var(--active) * 1.5rem + (1 - var(--active)) * 0.5rem);
|
|
background-color: hsla(0, 0%, 85%, var(--active));
|
|
|
|
border: 1px solid var(--light);
|
|
border-radius: 9999px;
|
|
transition: all 0.5s ease-in-out;
|
|
}
|
|
|
|
.icon {
|
|
font-size: 0.75rem;
|
|
color: var(--dark);
|
|
line-height: 1rem;
|
|
|
|
transform: translateX(calc(-1rem * (1 - var(--active))));
|
|
transition: transform 0.5s ease-in-out;
|
|
}
|
|
|
|
.text_button {
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
padding-block: 0.5rem;
|
|
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
color: var(--light);
|
|
|
|
text-transform: capitalize;
|
|
}
|
|
.text_button::before {
|
|
content: "";
|
|
|
|
position: absolute;
|
|
bottom: 0;
|
|
right: 0;
|
|
|
|
width: calc((1 - var(--active)) * 100%);
|
|
height: 1px;
|
|
background-color: var(--light);
|
|
|
|
border-radius: 9999px;
|
|
transition: width 0.5s ease-in-out;
|
|
}
|
|
|
|
</style>
|
|
|