Images are not being shown on the desktop carousel display

I am encountering an issue with my carousel. When I attempt to decrease the height of the carousel, the entire image is not being displayed properly (on desktop), although it works fine on mobile devices.

My goal is for the carousel not to take up the entire page. To see the output in full screen mode, please refer to the example below:

Example:

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
@import url('https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
 #carousel-example-generic .carousel-inner .item {
  padding-bottom: 50%;
}
#carousel-example-generic .carousel-inner .first-item {
  height: 100%;
  width: 100%;
  background: url('http://p1.pichost.me/i/13/1359503.jpg');
  background-size: cover;
  background-position: center;
}
#carousel-example-generic .carousel-inner .second-item {
  height: 100%;
  width: 100%;
  background: url('http://all4desktop.com/data_images/1920%20x%201200/4211692-abstract-color-background-picture-8016.jpg');
  background-size: cover;
  background-position: center;
}
#carousel-example-generic .carousel-inner .third-item {
  height: 100%;
  width: 100%;
  background: url('http://www.macwallhd.com/wp-content/Wallpapers/Abstract/Mac%20Wallpaper%20Spin%20The%20Apple%20Circle-575024442.jpeg');
  background-size: cover;
  background-position: center;
}
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<div id="carousel-example-generic" class="carousel slide slid" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner" role="listbox">
    <div class="item active first-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item second-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
    <div class="item third-item">
      <div class="carousel-caption">
        ...
      </div>
    </div>
  </div>
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

Answer №1

Implementing the CSS below will set a maximum width and ensure that the element is proportionally limited in width based on its height:

#carousel-example-generic {
  max-width: 960px;
  margin: auto;
}

Result:

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

Preventing JQuery spinner from resetting the value based on the set step size

Is it possible to set the jQuery spinner to increment by 5 but start at an initial value of 1, then proceed with increments of 5 (resulting in values such as 6, 11, and so on)? Currently, when I define a step of 5, the spinner seems to ignore the initial v ...

Altering the background color of an individual mat-card component in an Angular application

Here is the representation of my mat-card list in my Angular application: <div [ngClass]="verticalResultsBarStyle"> <div class="innerDiv"> <mat-card [ngClass]="barStyle" *ngFor="let card of obs | async | paginate: { id: 'paginato ...

Tips for waiting for a page to fully load before clicking the "load more" button using selenium

When using Selenium to load a page and attempting to click the "load more" button, encountering an issue after clicking it more than 100 times. An error of "element click intercepted" is being displayed, as the page takes longer to load after multiple cli ...

Issue with scrolling functionality on dynamically inserted items in jQuery mobile list

I have encountered an issue where the scrolling on my page is not working properly after dynamically adding jQuery mobile list items using jQuery ajax response object. The function responsible for handling AJAX success looks like this: success: function( ...

Utilizing JQuery and AJAX to fetch a specific variable

Hey there, I'm new to jQuery and AJAX. I've been attempting to pass a value from page 2 to page 1 using this script, but it doesn't seem to be working properly. Check out the script: function prova() { var parametro = $("#nome_priv ...

Android Gmail Application: Implementing 1px horizontal spacing between inline images placed within <td> tags

Have you ever noticed that in the Android Gmail app, there can be a mysterious 1px gap between inline images? This little pixel problem can sometimes push the rightmost image outside the comfy frame of your email. It seems this glitch prefers images of cer ...

Click on the links to view various captions for a single image, one at a time

My goal is to create an interactive image similar to what can be found at . (Click Play and navigate to page 5 to see the interactive physical exam). While this example seems to use Flash, I am interested in achieving a similar effect using javascript/jQue ...

Implementing modifications to all HTML elements simultaneously

In my HTML document, there are around 80 small boxes arranged in a grid layout. Each box contains unique text but follows the same structure with three values: name, email, and mobile number. I need to switch the positions of the email and mobile number v ...

How to trigger a JavaScript function using a button click

I've been struggling to figure out why my JavaScript code isn't functioning properly within Ionic. Can anyone guide me on how to store a number in a variable, display that variable, and increment it when a button is clicked? I have successfully ...

What is the best way to ensure the content div fills all available space? (JQM compatibility concerns)

Currently, I am facing an issue with displaying a pdf in an iFrame within my app. The problem lies in the fact that the iFrame does not occupy the entire space between the header and footer divs on the page. I am utilizing Jquery Mobile 1.1.0 for the theme ...

Is there a way for me to set distinct values for the input box using my color picker?

I have two different input boxes with unique ids and two different color picker palettes. My goal is to allow the user to select a color from each palette and have that color display in the corresponding input box. Currently, this functionality is partiall ...

Universal message/status/error that can be utilized in both jquery and C# programming

There are instances where we utilize the same error or success messages, as well as checking for certain statuses, in both jQuery and C#. To maintain consistency, it is ideal to define all message/status flags within a static class and access them whereve ...

What does the visual representation of <html> look like, exactly?

Where does the scroll bar belong, within the <html> or <body> tags? I've always included it in every HTML file, but unsure of its specific purpose. ...

Deliver JavaScript and HTML through an HTTP response using Node.js

My attempts to send both a JavaScript file and an HTML file as responses seem to be failing, as the client is not receiving either. What could be causing the client to not receive the HTML and JavaScript files? I am using Nodejs along with JavaScript and H ...

Retrieve the content of a text field with jQuery

Check out this block of HTML: <div class="sub-middle-column"> <div class="div-header">Grandsire <a "#", class="table-control-focus sub-header-table-focus" id="table-control-focus-t" >abc</a> <ul class="table-controls h ...

Pulling information from a database query to store it within a JavaScript variable

Using Ajax/JQuery, I successfully send the variable ($name) from page1.php to page2.php without refreshing the page. When the submit button is clicked, it sends me the var $name effectively. Additionally, in my JavaScript library for charts (AmCharts), the ...

Using clearfix on every div element is essential to avoid container collapsing

Would it be beneficial to include clearfix in every div element to avoid container collapse issues? Or is it more practical to apply it only to specific classes, like so? <div class="container"> Additional div elements... </div> .containe ...

The content of btn-id element in Angular is showing as undefined

I have a JavaScript file located at sample/scripts/sample.js and there are 8 HTML files in the directory sample/src/templates/. My goal is to select a button on one of the HTML files. When I tried using angular.elemnt(btn-id).html(), I received an 'un ...

How can the seating arrangement be optimized for a seating chart and what is the most effective way to transition away from a traditional table structure?

Currently, I am attempting to create a dynamic seating chart on a webpage within an asp.net-mvc site using data retrieved from a database. Initially, I used a table to organize the grid layout of rows and columns, which resembled this structure: The datab ...

spacing for margins of table elements generated dynamically

Despite setting the width for the td tag, there seems to be a significant gap between the Odo and Location columns. Below is a basic table structure: <table width="95%" border="0" cellspacing="0" cellpadding="2"> <tr> <td wi ...