Skip to content

Commit 446ae35

Browse files
jnnscodingjoe
authored andcommitted
Add documentation for <picture> / <img> attributes
Ref #60
1 parent 11baf60 commit 446ae35

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,24 @@ class Profile(models.Model):
3737
```html
3838
<!-- template.html -->
3939
{% load pictures %}
40-
{% picture profile.picture img_alt="Spiderman" img_loading="lazy" m=6 l=4 %}
40+
{% picture profile.picture img_alt="Spiderman" img_loading="lazy" picture_class="my-picture" m=6 l=4 %}
4141
```
4242

4343
The template above will render into:
4444
```html
45-
<picture>
45+
<picture class="my-picture">
4646
<source type="image/webp"
4747
srcset="/media/testapp/profile/image/800w.webp 800w, /media/testapp/profile/image/100w.webp 100w, /media/testapp/profile/image/200w.webp 200w, /media/testapp/profile/image/300w.webp 300w, /media/testapp/profile/image/400w.webp 400w, /media/testapp/profile/image/500w.webp 500w, /media/testapp/profile/image/600w.webp 600w, /media/testapp/profile/image/700w.webp 700w"
4848
sizes="(min-width: 0px) and (max-width: 991px) 100vw, (min-width: 992px) and (max-width: 1199px) 33vw, 600px">
4949
<img src="/media/testapp/profile/image.jpg" alt="Spiderman" width="800" height="800" loading="lazy">
5050
</picture>
5151
```
5252

53+
Note that arbitrary attributes can be passed
54+
to either the `<picture>` or `<img>` element
55+
by prefixing parameters to the `{% picture %}` tag
56+
with `picture_` or `img_` respectively.
57+
5358
## Setup
5459

5560
### Installation

0 commit comments

Comments
 (0)