Width and height attributes to Carousel images


Topic: Width and height attributes to Carousel images

AnnaK pro premium asked 4 years ago

Hello!

Is it possible to somehow add width and height attributes to the Carousel images? PageSpeed insights has started to complain about these missing attributes.

Thank you! Anna


Arkadiusz Idzikowski staff commented 4 years ago

@AnnaK you should be able to add attributes to the img that is inside mdb-carousel-item component. These elements are not hidden in the internal component template.


AnnaK pro premium commented 4 years ago

Can you please advice how?

If I e.g. put the attribute here:mdb-card-img [src]="card.img" alt="{{ card.alt }}" width="100"

then the width attribute will not render on the page


Arkadiusz Idzikowski staff commented 4 years ago

@AnnaK that's because we already add w-100 class to the img elements to make sure that the carousel layout is displayed correctly. We don't recommend removing this class, if you need to reduce images width, you should put the carousel inside a container and modify the width of the container.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: 9.0.1
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No
Tags