How can I set a background image with svelte?
The code is here for reference: Svelte sandbox
You got it right. We probably can't use static assets on the REPL but what you did works well with any image from the web:
From your style section in Todos.svelte:
:global(body){
background-color: lightseagreen;
background-image: url("https://images.pexels.com/photos/956981/milky-way-starry-sky-night-sky-star-956981.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With