mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
448 B
20 lines
448 B
6 years ago
|
---
|
||
|
title: Styling
|
||
|
---
|
||
|
|
||
|
Just like in HTML, you can add a `<style>` tag to your component. Let's add some styles to the `<p>` element:
|
||
|
|
||
1 year ago
|
```svelte
|
||
3 years ago
|
<p>This is a paragraph.</p>
|
||
|
|
||
6 years ago
|
<style>
|
||
|
p {
|
||
|
color: purple;
|
||
5 years ago
|
font-family: 'Comic Sans MS', cursive;
|
||
6 years ago
|
font-size: 2em;
|
||
|
}
|
||
|
</style>
|
||
|
```
|
||
|
|
||
1 year ago
|
Importantly, these rules are _scoped to the component_. You won't accidentally change the style of `<p>` elements elsewhere in your app, as we'll see in the next step.
|