q-img and fit attribute, can I use CSS object-fit instead? #14864
-
|
Hi, I took the suggestion, here is my codepen. QB should be the same as Q2 and B. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
make a codepen |
Beta Was this translation helpful? Give feedback.
-
|
For QImg you need to target the read image .q-img.contain > .q-img__container > .q-img__image.q-img__image--loaded {
object-fit: contain !important;
}
.q-img.cover > .q-img__container > .q-img__image.q-img__image--loaded {
object-fit: cover !important;
}https://codepen.io/pdanpdan/pen/GRGWvjR?editors=1100 (fixed wrong codepen link) |
Beta Was this translation helpful? Give feedback.
For QImg you need to target the read image
I put the final
.q-img__image--loadedso that the rule does not change the placeholder image, but it's not mandatory.The full chain of selectors is used so that you can put a QImg in another QImg
https://codepen.io/pdanpdan/pen/GRGWvjR?editors=1100
(fixed wrong codepen link)