Sha256: e2f8b2307a3b7b950eaf8345f84081fe25946fb994d5b4d0996d9b474070c5f9

Contents?: true

Size: 897 Bytes

Versions: 3

Compression:

Stored size: 897 Bytes

Contents

---
sort: 7
---

# Width & Height (Anti-Loading-Jank)

_Format:_

```yml
dimension_attributes: true | false
```

_Example:_

```yml
dimension_attributes: true
```

_Default:_ `false`

Prevent page reflow (aka jank) while images are loading, by adding `width` and
`height` attributes to the `<img>` tag in the correct aspect ratio.

For an explanation of why and how you want to do this,
[here](https://youtu.be/4-d_SoCHeWE) is a great explanation.

Caveats: 
  * You need either `width: auto;` or `height: auto;` set in CSS on the `<img>`
  tags, or they will be stretched.
  * This works on `<img>` tags and `<picture>` tags when offering images in
  multiple widths and formats, but it does not work if you are using art
  direction (in other words, if you have multiple source images). This is
  because these attributes can only be applied to the `<img>` tag, of which
  there is exactly one.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll_picture_tag-1.14.0 docs/users/presets/width_height_attributes.md
jekyll_picture_tag-1.13.0 docs/users/presets/width_height_attributes.md
jekyll_picture_tag-1.12.0 docs/users/presets/width_height_attributes.md