Add class selector to b-avatar img tag for custom images in default slot instead of using element selector
See original GitHub issueIs your feature request related to a problem? Please describe…
We need to override b-avatar’s img
tag to add a loading="lazy"
. Unfortunately, the img
css in bootstrap-vue uses an element selector as .b-avatar-img img
rather than a unique class for the image tag, so we have to duplicate the css code.
Describe the solution you’d like
It would be preferable for it to be a class selector rather than an element selector. Then we could override the image exactly how it works in bootstrap-vue.
<b-avatar ...>
<template v-if="src" #default>
<img :src="src" class="copied-from-b-avatar-img"> <!-- current -->
<img :src="src" class="b-avatar-img-element"> <!-- preferred -->
</template>
Describe alternatives you’ve considered
We currently have to copy the code from .b-avatar-img img
to our system, which isn’t ideal or future proof.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Select a specific img tag in li tag - css - Stack Overflow
Your CSS selector selects all img-tags, that are directly a child of an a-tag inside your #menu-item-4. try this: #menu-item-4 > a img ......
Read more >slotted() - CSS: Cascading Style Sheets - MDN Web Docs
The ::slotted() CSS pseudo-element represents any element that has been placed into a slot inside an HTML template (see Using templates and ...
Read more >ion-img Tag - Ionic Framework
Img is a tag that will lazily load an image whenever the tag is in the viewport. This is extremely useful when generating...
Read more >Picture perfect images with the modern <img> element
To place an image on a web page, we use the <img> element. ... set of images the browser can select from, as...
Read more >Image component — Vuetify
v-img component is used to display a responsive image with lazy-load ... gradients should be written as a class on the content slot...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could just wrap the
<img>
in a<span>
with the classb-avatar-img
. Should give the same result, except that there’ll be an additional span in the DOM.Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!