CSS - owl carousel automatically stretches images to full width

Here is the code snippet that I am working with:

$(document).ready(function() {
    $('.owl-carousel').owlCarousel({
    loop:true,
    items:4,
    autoplay:true,
    autoplayTimeout:2000,
    autoplayHoverPause:true
    });
});
#owl-demo .item{
margin: 3px;
}
#owl-demo .item img{
display: block;
height: auto;
}
<div id="owl-demo" class="owl-carousel">
    <div class="item"><img src='public/media/image/rabobank.webp' alt='' style='height: 122px !important;'/></div>
    <div class="item"><img src='public/media/image/sep.webp' alt='' style='height: 122px !important;'/></div>
    <div class="item"><img src='public/media/image/rotary.webp' alt='' style='height: 122px !important;'/></div>
    <div class="item"><img src='public/media/image/woordbeeld.webp' alt='' style='height: 122px !important;'/></div>
    <div class="item"><img src='public/media/image/kiwanis.webp' alt='' style='height: 60px !important; margin-bottom: 2% !important;'/></div>
    <div class="item"><img src='public/media/image/-.webp' alt='' style='height: 122px !important;'/></div>
    <div class="item"><img src='public/media/image/dj.webp' alt='' style='height: 122px !important;'/></div>
</div>
<script src="<?= $this->getThemeURL(); ?>Assets/Js/owl.carousel.min.js"></script>

I will show an image of how it currently appears ->. Image However, this is not the desired look. How can I adjust it to use the original dimensions of the images?

Answer №1

One solution could be to remove the style tag from the images directly.

Instead, update the css style with this code snippet:

#owl-carousel .image-container img {
    display: block;
    width: 100%;
    max-width: adjust to match image size;
    height: auto;
}

Adding a max-width property to the carousel itself can also prevent it from expanding beyond your desired limits.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using JQuery to iterate through every unique div id in the HTML document

i am attempting to utilize jquery to iterate through each div tag that has an id of "rate". The goal is for jquery to execute a function on the individual divs. Here is my code snippet: information.html <html> <input class="rate" type="hidden ...

Guidelines for dynamically displaying <router-link> or <a> in Vue based on whether the link is internal or external

<template> <component :is="type === 'internal' ? 'router-link' : 'a'" :to="type === 'internal' ? link : null" :href="type !== 'internal' ? link : null" > <slot /> < ...

Failure to retrieve fax API data using Twilio's Node.js HTTP requests

Looking to implement fax receiving using Twilio API. This is an excerpt from my index.js file: // const http = require('http'); const express = require('express'); const bodyParser = require('body-parser'); c ...

Adjusting the box sizing of a contentEditable DIV to conceal the first and last characters

I am having trouble with a ContentEditable div that requires the hiding of characters, specifically the first and last character. I need to overlay a layer on top of the "#" character to make it appear as if the character and the border line beneath it are ...

Encountering a 401 error while attempting to exchange Faceit OAuth authorization code for access token

I am having issues with exchanging a code for a token on the Faceit OAuth. The documentation states the following: Exchanging the Authorization Code for an Access Token The third-party app needs to make a server-to-server call, providing the Authorization ...

Transform one div to another using a CSS animation slide

I am experiencing an issue with two divs (page1 + page2) inside a container (also a div). The container has overflow:hidden property, but when the animation starts, the overflow configuration is being ignored. Additionally, the page that should be displaye ...

Reviewing file information prior to submission

Is there a way or method we can utilize to validate file details (extension and size) before the form is submitted by the user? I have limited knowledge of jQuery or JavaScript, so please provide detailed assistance if that is the solution. I envision tha ...

Breaking or wrapping lines in Visual Studio Code

While working in Visual Studio Code, I often encounter the issue of long lines extending beyond the screen edge instead of breaking and wrapping to the next line. This lack of text wrapping can be quite bothersome. I utilize a split-screen setup on my co ...

The button's color remains static in Internet Explorer despite attempts to change it using a linear gradient background image

I'm curious why the button appears grey in IE and turns blue on hover, rather than starting off blue and becoming darker blue when hovered over. I've managed to make it work in other browsers, but I'm struggling with the code for IE. Thank ...

What is the best way to evenly distribute items in nested CSS Grid Columns?

Check out this JSFiddle link for a simple Google.com recreation. I'm attempting to organize the top navigation bar by creating separate containers for About, Store, Gmail, and Images. The issue seems to be related to the justify-items:center; propert ...

Having trouble uploading files with jQuery File Upload functionality

Issue: I need to set a session variable and redirect the user to a different PHP page after uploading a .txt file using jQuery File Upload. HTML code (upload.php): <!-- The fileinput-button span is used to style the file input field as button --> ...

Is it possible to incorporate HTML content into the metadata within the head section of a Nuxt application?

Received HTML content from the backend that needs to be incorporated into the meta tag of the HTML head using nuxt. Encountered an error when attempting to display the received content View Error Outlined below is the code implementation: Snippet of Code ...

Exploring the origins of CSS through patch design

Want to learn how to create a background like this using CSS? Check out this link for inspiration! ...

What is the correct way to submit a formarray in an angular application following the specified format?

When submitting a form in Angular, I'm facing an issue where only the data from the first index inside the role menu is being passed. How can I ensure that all index data is passed on submit? { "roleMenu":[{ "menu":{ "menuId": 1 }, ...

What is the best way to show a label and select box side by side using Angular Material?

I have been trying to keep input and label in the same line using Angular Material, but I haven't found a solution yet. Most of the available solutions are in HTML and CSS, but I specifically need a way using Angular Material. The method I tried invo ...

What is the best way to make a gradient fill and rounded border with CSS?

I am interested in creating a gradient and rounded border similar to the top bar on Instagram. Although I know how to create a rounded and solid border, this one utilizes a gradient. It appears that Instagram uses a canvas, but I am wondering if it can b ...

(React Native) Creating a visually appealing grid layout for displaying an array of item cards

I am working with two arrays named 'word' and 'definition' export default class Dictionary extends React.Component { constructor(props) { super(props); this.state = { word: [], definition:[], index: ...

Are there any straightforward methods to fully freeze an object along with all its descendants in JavaScript (Deep Freeze)?

Often when passing an object as a parameter, functions may access the object by reference and make changes to the original object. This can sometimes lead to unwanted outcomes. Is there a way to ensure that an object remains unchanged? I am aware of the Ob ...

An issue arose when attempting to submit data from an AngularJS form

I am having an issue with my AngularJS form that is supposed to post data to a Scalatra servlet. Unfortunately, when the form is submitted, I am unable to retrieve any form parameters in my Scalatra servlet. Here is a snippet of my code: AngularJS $scop ...

Include a border around the entire tooltip

I'm having trouble adding a border to my tooltip that follows the outer lines of the entire tooltip. Currently, I've only been able to add a border to the upper part of the tooltip, which overlaps with the arrow section and isn't the desired ...