Skip to content

Instantly share code, notes, and snippets.

@helabenkhalfallah
Created April 10, 2024 18:56
Show Gist options
  • Save helabenkhalfallah/263f3519fc01f57562f3372e2b3dff4b to your computer and use it in GitHub Desktop.
Save helabenkhalfallah/263f3519fc01f57562f3372e2b3dff4b to your computer and use it in GitHub Desktop.
Svelte Scoped CSS
<!-- CustomButton.svelte -->
<button on:click> Click me </button>
<style>
button {
height: 4rem;
width: 8rem;
background-color: #aaa;
border-color: #f1c40f;
color: #f1c40f;
font-size: 1.25rem;
background-image: linear-gradient(45deg, #f1c40f 50%, transparent 50%);
background-position: 100%;
background-size: 400%;
transition: background 300ms ease-in-out;
}
button:hover {
background-position: 0;
color: #aaa;
}
</style>
<!-- Generated Svelte CSS -->
button.svelte-hg07jm{height:4rem;width:8rem;background-color:#aaa;border-color:#f1c40f;color:#f1c40f;font-size:1.25rem;background-image:linear-gradient(45deg, #f1c40f 50%, transparent 50%);background-position:100%;background-size:400%;transition:background 300ms ease-in-out}button.svelte-hg07jm:hover{background-position:0;color:#aaa}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment