![]()
You can do the same thing with a regular image using object-fit. If you're familiar with how backgrounds work, you know that you can set the background-size attribute to cover and the browser will proportionally resize the background to fit the space available. To fix this we can use some newer CSS properties that you may have not heard of. Object Fit & Object Position to the rescue If you put the carousel above some content, the content beneath the images will shift as you try to read the content. ![]() When the image changes so does the height of the container. See the Pen Carousel Problem by Ray on CodePen. But what if the images aren't exactly the same height or proportions? The documentation tells you to add an an image with a class of d-block w-100 That means that it will shrink or stretch the image to whatever height will fit in the width. #Bootstrap studio 4.4.4 full series
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |