You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/tutorial/01-introduction/03-dynamic-attributes/text.md
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
title: Dynamic attributes
3
3
---
4
4
5
-
Just like you can use curly braces to control text, you can use them to control element attributes.
5
+
You can use curly braces to control element attributes, just like you use them to control text.
6
6
7
-
Our image is missing a `src` — let's add one:
7
+
Our image is missing a `src`attribute — let's add one:
8
8
9
9
```html
10
10
<imgsrc={src}>
@@ -24,12 +24,10 @@ In this case, we're missing the `alt` attribute that describes the image for peo
24
24
25
25
We can use curly braces *inside* attributes. Try changing it to `"{name} dances."` — remember to declare a `name` variable in the `<script>` block.
26
26
27
-
28
27
## Shorthand attributes
29
28
30
29
It's not uncommon to have an attribute where the name and value are the same, like `src={src}`. Svelte gives us a convenient shorthand for these cases:
0 commit comments