Arranging li elements with images side by side using Bootstrap

Essentially, I have a series of screenshots representing a function in an app and I want to convert each screenshot into a list item. Although I have managed to make them display inline, they only occupy part of the row and the layout stops after three images. Is there a way to extend them to use the entire row?

Code Snippet :

<div class="row">
   <h3 id="{{anchor}}" class="headline my-4">{{{title}}}</h3>
       <ul class="d-block">
         {{#each images}}
         <li class="col-6 col-sm-4 col-md-3 mb-4 list-inline-item">
             <div class="list-inline-item">
                 <a href="{{{filename}}}.png" data-lightbox="{{{../anchor}}}">
                       <img loading="lazy" data-src="{{{filename}}}.png" class="img-fluid img-shadow lazy" alt="{{{alt}}}" title="{{{alt}}}">
                 </a>
             </div>
         </li>
         {{/each}}
       </ul>

And here's an example below!

https://i.sstatic.net/4bIgL.png

Answer №1

The issue may be with the padding or margins causing the 4th card to wrap onto the next line. To address this in Bootstrap, you can utilize specific classes for controlling the margins on your list items (li). If adjusting the margins doesn't solve the problem, you could also experiment with changing the padding using these classes:

m-0 no padding
mx-0 no padding horizontal
my-0 no padding vertical
ms-0 no padding left (start)
me-0 no padding right (end)

It's also important to consider that the culprit might not be the li elements themselves but rather the list-inline-item class. It's worth trying out different adjustments to see what works best for your layout :)

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

Implementing HTML content into jQuery: A step-by-step guide

Currently, I am diving into the world of JavaScript and jQuery. However, it seems like my code is not working properly. While it does create a window, it fails to insert any text into it. Any insights on what may be going wrong would be greatly appreciated ...

Turn off sticky sidebar feature for mobile-friendly layout

I have encountered an issue with my script that I need assistance with. I am trying to disable this script for responsive or mobile view, but despite trying various methods, it is not functioning as expected. <script type="text/javascript"> $(func ...

Ensure that the table header remains in place while scrolling within a fixed height constraint

I am experiencing a repeated <tbody> element in my bootstrap table with a fixed height of 140px, and I have implemented scrolling if the data exceeds that height. I am encountering challenges in keeping the header with values 'Season 2018 2019 ...

Utilizing AngularJS for managing multiple controllers within a single file

As a beginner with angular JS, I am currently focusing on controllers and have created the script below. <!DOCTYPE html> <html> <head> <title>just learnin!</title> </head> <body> <div data-ng-app="clock ...

Can you explain why this unexpected bootstrap positioning is happening?

On my website, I have two large buttons (btn-lg) - one is placed at the top of the page with a hidden form beneath it (initially set to display: none), and the other button is below that with another hidden form. When clicked, the buttons reveal their resp ...

Drag near the bottom of a droppable DIV to scroll inside

Within a scrollable div, I have multiple draggable divs. However, when I drag them into another scrollable div (the droppable zone), only the page scrolls and not the droppable div itself. How can I make it so that only the droppable div scrolls while drag ...

Show an item vertically centered within its parent container

Following is the appearance of the selector: https://i.sstatic.net/njql9.png The text currently appears close to the bottom of the selector. I would like it to be centered vertically while maintaining its horizontal positioning towards the left side. He ...

Keep the span's width constant even when it is empty

Is there a way to preserve the width of an empty span element? Consider the following HTML pseudo table: <p><span class="col1">Day:</span><span class="col2"><?php echo somephp ?></span></p> <p><span clas ...

Consistently showcasing images of varying dimensions that are unfamiliar

Currently, I'm in the process of developing a small web application that uses the Spotify API to fetch and showcase top tracks and artists to users. Each track or artist is presented within a Bootstrap panel, with the title displayed in the header an ...

"Step-by-step guide on using a PHP for loop to insert multiple values into a database

I have a textbox and a dropdown box in each row. My goal is to input some date into the textbox and select a value from the dropdown. Upon clicking, I want this information to be saved in the database. What is the best way to achieve this? Below is the ...

Struggles working with css in react applications

Looking for some assistance here... In the code snippet below, I have two separate elements that I want to display one at a time. The first element is an iframe and the second is a div. The idea is that if the user clicks on the {title}, the frame disap ...

The querySelector function is now encountering errors due to a change in the data

Currently, I am utilizing a query selector to retrieve an input when a user selects different buttons. Initially, the buttons had options such as: 8x10 inch 12x16 inch 20x24 inch However, I made changes to the options format like so: 8" x 10" ...

Refresh the options in a dropdown menu after selecting a radio button using jQuery

Upon selecting either the male or female radio button, I wish to populate a list with names corresponding to the selected gender from a database. The male and female tables in the database consist of two columns: {id} and {name}. <?php include "co ...

Confirmation of successful submission of an HTML form

Here is a straightforward html form: <form id="form1" method="post" target="_self"> <input type="text" name="lastname"> <input type="submit" value="Register" /> <form> I am looking to replace the content of this page with a succes ...

JavaScript function occasionally experiences loading issues with CSS images

Have you ever encountered issues with a CSS background image failing to load? What might be the underlying cause? I've written some Javascript code that looks like this: function progressBar(file_id) { pbar = ($("<div />").attr('id&a ...

Having difficulty grasping the concept behind the prepend method's functionality

I encountered an issue with my code, where I successfully created a <th> element initially, but faced problems when trying to create it repeatedly. function createTH(){ var noOfRow = document.getElementById("addItemTable").rows.length; var t ...

PHP script, creating a public function that manipulates an array while also incorporating CSS styles

Within a public function, I have the following PHP: [ 'type' => 'text', 'desc' => $this->l('some information'), ] Using this code will show the text "some information" on a webpage. Is there a way ...

Changing the cursor while the onDrag event is active in ReactJs

I want to implement Drag functionality on certain elements in my application, but I am facing an issue where the cursor changes during dragging. How can I change the cursor specifically when onDrag is active? ...

Strategies for resolving minor validation challenges (Almost complete, just a few finishing touches needed ...)

This question was originally posted in Spanish on es.stackoverflow.com by Julian Dumitrel: I had planned to make a record, step by step, where I had 3 different steps all within one <form>. After finishing my form validator successfully, I encounte ...

Issue with Bootstrap navbar not highlighting section items when scrolled to

I have recently developed a webpage using html5, css3, and bootstrap. However, I am facing an issue with the navbar menu not highlighting the items that are pointing to specific sections on the page. I would like the navbar menu to automatically highlight ...