Arrange a row of six images side by side using responsive Bootstrap styling

Struggling to align 6 images in one row using bootstrap, but only getting 4 images with a large space between them. CSS isn't my strong suit.

Here's the HTML Code:

<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<style>
.container-best
{
  width:70%;
  text-align:center;
      margin: auto;
}
.best-rate
{
  background-color: #ffd564;
  text-align: center;
  font: 20px 'aleobold', sans-serif;
  color: #4c4145;
  text-transform: uppercase;
  padding-bottom: 25px;
  padding-top: 26px;
  position: relative;
}
</style>
</head>
<body>
<div class="container">
<div class="container-best">
<div class="best-rate">
☆☆☆☆☆☆☆Today Best Choice☆☆☆☆☆☆☆
</div>
</div>  
<br />
<div class="row">
  <div class="col-md-2 col-md-offset-1">
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg">
  </div>
  <div class="col-md-2 col-md-offset-1" >
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Narco-Valley.jpg">
  </div>
  <div class="col-md-2 col-md-offset-1" >
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Vikingdom.jpg" >
  </div>
  <div class="col-md-2 col-md-offset-1" >
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Red-Dirt-Rising.jpg" >
  </div>
  <div class="col-md-2 col-md-offset-1" >
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/At-All-Cost.jpg" >
  </div>
  <div class="col-md-2 col-md-offset-1" >
    <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg" >
  </div>      
  </div>        
    <div>
</body>
</html>

Have tried fixing it multiple times without success. Not sure what's causing the issue. Any help is appreciated.

Thanks!

Answer №1

To start, include the CSS class:

.img-responsive{
   width: 100%;
}

Next, remove the "col-md-offset-1" from the div tag and insert the images into the container.

<div class="container"> 
  <div class="row">
    <div class="col-md-2">
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg">
    </div>
    <div class="col-md-2" >
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Narco-Valley.jpg">
    </div>
    <div class="col-md-2" >
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Vikingdom.jpg" >
    </div>
    <div class="col-md-2" >
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Red-Dirt-Rising.jpg" >
    </div>
    <div class="col-md-2" >
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/At-All-Cost.jpg" >
    </div>
    <div class="col-md-2" >
      <img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg" >
    </div>      
  </div>        
</div>

Answer №2

To resolve the issue, simply eliminate the col-md-offset-1 class from the columns. Remember that Bootstrap follows a 12 column layout system. In this case, you have an excess of columns in a single row: 6*2 (from columns) + 6*1 (from offset) = 18.

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

Utilize the Twitter Bootstrap modal feature to play autoplaying Youtube videos that automatically pause when

Similar Question: How do I halt a video using Javascript on Youtube? I am curious about how I can utilize the modal feature in Twitter Bootstrap to automatically play a Youtube video, and when a user clicks the "close" button, it will cease the video ...

What could be causing the div class to move downward in the CSS code?

I have posted a question, but unfortunately, no one has answered it yet. Here is my code snippet: * { margin: 0; padding: 0; } body { width: 100%; font-family: 'Cabin', sans-serif; background-color: #333; } .firstnav { ...

Modify the width to fit the available space using flex containers

I'm currently working on adjusting the width of a container in case it cannot accommodate an additional character box. IMAGE: Eliminate excess spacing by resizing the width Here is the HTML code <section id="list_users"> <div i ...

Is it possible to have an input field that is read-only without altering the mouse icon

echo '<input type="text" class="form-control" value="' . $server->address . ":" . $server->connection_port . '">'; Can readonly mode be activated for this input without altering its CSS or the mouse icon when hovering over ...

Using @font-face with Rails version 2.3.8

Hello, I am having trouble including a custom font in my Rails application. I am currently using Rails 2.3.8. I have placed my font folder in the public folder and below is my CSS code. However, it seems to not be working. Can anyone provide some assistan ...

How come only the individual top, bottom, left and right paddings function correctly while the combined padding does not respond?

Seeking to customize a button using SCSS file that is connected to HTML. This button is part of a flex layout design. The element's size is set at 83.333×16px. The box-sizing property is defined as: box-sizing: border-box; Adding padding with s ...

How can I convert a PHP array into radio buttons in an HTML form?

I'm looking to develop a survey using HTML, PHP, and Javascript. I have my questions and answers stored in a csv file (which will eventually be transferred to a SQL server). My main concern is how to convert my answers into radio button types so that ...

List without order - item position in the list

I currently have a website featuring 5 pages, with the main navigation displayed using an unordered list. My goal is to have the "active" page displayed first in the list. For example, if my pages are "Home | About | Contact | Blog" and the user is on the ...

How can I arrange an ItemTemplate and Alternating ItemTemplate next to each other in a Gridview layout?

My webpage features a "Reports" page that will dynamically display buttons (formatted ASP:Hyperlinks) based on the number of active reports in a table. While everything works well, I am struggling with achieving the desired layout. I want my buttons to app ...

Issue with CSS background scaling bug

Is it possible to make the cloud background scale within the box? The current issue can be viewed here: I have tried various methods to resolve the problem where the background scales even beyond the limited box. However, I could not identify the solutio ...

Enhancing transparency with a touch of background color

After successfully exporting my chart created in canvas as an image file, I noticed that the image turned out to be transparent without any background. Is there a way through code to add a background color to this existing image obtained from canvas? For ...

The Google Docs viewer is displaying an empty screen

I have been utilizing the Google Docs viewer on my website: <div class="embed-r embed-responsive-a"> <iframe class="embed-responsive-it" src="https://docs.google.com/viewer?embedded=true&amp;url=http://LINK.PDF"></iframe> </div& ...

Creating a responsive design with dual backgrounds using Tailwind CSS

I have a design in Figma that I want to convert to React using Tailwind CSS while maintaining 100% pixel-perfect accuracy. The design is created for a Macbook Pro 16 inch, which has a width of 1728px. However, I want to center the content within a customiz ...

Obtaining the contents of a local directory with JavaScript

Currently, I am attempting to access the contents of a local folder using JavaScript. Despite my efforts with the Filesystem API, an error is consistently appearing: DOMException: It was determined that certain files are unsafe for access within a Web app ...

Is it possible to center the image and resize it even when the window is resized?

My goal is to position an image in the center of the screen by performing some calculations. I've tried using: var wh = jQuery(window).innerHeight(); var ww = jQuery(window).innerWidth(); var fh = jQuery('.drop').innerHeight(); var fw = jQ ...

The presence of the StickyHeader Row is causing an obstruction in the drop down list view

I have successfully made the row header of the Material UI Table component sticky by utilizing the stickyHeader attribute. <Table stickyHeader className={classes.table}></Table> Above this table, there are two drop-downs that are created using ...

Utilize jQuery to dynamically assign classes to list items within a unordered list based on the length of an array

HTML: <ul class="tickboxes"> <li><i class="fa fa-check"></i></li> <li><i class="fa fa-check"></i></li> <li><i class="fa fa-check"></i>< ...

When two elements overlap, adjust their CSS positions to ensure responsiveness

Is there a way to adjust the position of an element when it comes into contact with another? Check out this example http://jsfiddle.net/mZYR8/1/ In the example, if .title-wrap (yellow) touches .right-wrap (orange), I want the orange element to slide unde ...

adjusting the background with repeat-y pattern placement

I'm having an issue with setting a background image as a wrapper for the main content of my page. Currently, I've set the background image like this: #background { background: url("../image/bg.png") repeat-y 133px 50px; color: #000000; ...

Loading CSS resources in advance can still cause rendering delays

Trying to preload CSS using a link tag with the "preload" attribute set Place this inside the Head tag: <link rel="preload" href="css/layout.css" as="style"> Then add this script at the bottom of the Body tag (although placement shouldn't mat ...