I want the carousel UI component to automatically adjust the height to match the width of the image.

Asked 1 years ago, Updated 1 years ago, 43 views


in the Onsen UI carousel (ons-carousel) Is it possible to automatically set the height according to the width of the image?
If I don't specify the height, it won't be displayed. I would like it to expand and contract according to the display, but is there any way to write it?

onsen-ui

2022-09-29 21:30

1 Answers

ons-carousel{
  position:static;
}
ons-carousel-item {
  overflow — hidden;
  height —initial!important;
}

Assume that <img> is just placed under ons-carousel-item.Wouldn't it be good to play with CSS like this?


2022-09-29 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.