Writing Your First Svelte Component

Posted on 2022-11-27 by

henrikvilhelmberglund

There is a REPL at the site where you can write code and run it in the browser.

In a .svelte file you can have a script tag, markup (HTML) and a single style tag that contains all of the styles.

My first Svelte component

Hello World

Link to Li Hau's youtube
<h2>My first Svelte component</h2>

<p>Hello World</p>

<a href="https://www.youtube.com/lihautan">Link to Li Hau's youtube</a>

<style>
  h2 {
    color: rebeccapurple;
  }
  p {
    color: blue;
    font-size: 44px;
  }
</style>

You can import a .svelte from anywhere and use it like a class.

Style your Svelte Component

Posted on 2022-11-27 by

henrikvilhelmberglund