Skip to content

Dynamic Attributes example: make example HTML consistent #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ When building web apps, it's important to make sure that they're _accessible_ to
In this case, we're missing the `alt` attribute that describes the image for people using screenreaders, or people with slow or flaky internet connections that can't download the image. Let's add one:

```svelte
<img src={src} +++alt="A man dances."+++>
<img src={src} +++alt="A man dances."+++ />
```

We can use curly braces _inside_ attributes. Try changing it to `"{name} dances."` — remember to declare a `name` variable in the `<script>` block.
Expand All @@ -29,5 +29,5 @@ We can use curly braces _inside_ attributes. Try changing it to `"{name} dances.
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:

```svelte
<img +++{src}+++ alt="A man dances.">
<img +++{src}+++ alt="A man dances." />
```