is it possible to automatically add width and height attributes?
#1076
Unanswered
stefanprobst
asked this question in
Q&A
Replies: 1 comment
-
|
Not generally, because Nuxt Image cannot know the intrinsic dimensions of every possible image source at compile time. Next can do this for static imports because the imported local file is part of the build graph, so the build step can inspect the image and attach width/height metadata. With Nuxt Image, many common sources are remote URLs, CMS assets, provider URLs, or runtime strings, so there may be nothing available at build time to inspect. The usual approaches are:
For layout stability, the important part is not necessarily automatic attributes; it is making sure the browser knows the intended aspect ratio before the image loads. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
is it possible to automatically add
widthandheightattributes to the image element?for example the next.js image component is able to do that for static image imports.
Beta Was this translation helpful? Give feedback.
All reactions