I'm having an issue with my bootstrap container not reaching its full width. Any tips on how to troubleshoot and

I'm trying to get all the images on my page to have full width, but I'm seeing some padding on the right and left edges. How can I fix this issue? Here is a screenshot of the problem:https://i.sstatic.net/bRXR2.jpg

Below is the HTML code I am using:

<div class="container-fluid">
      
        <div class="col"><a href="about.html"><img style="object-position: 60% 0%;" src="images/Life/1.jpg" alt=""></a></div>
        <div class="col"><a href=""><img src="images/Life/3.jpg" alt=""></a></div>
        <div class="col"><a href=""><img src="images/Lakers/L1000857.JPG" alt=""></a></div>
        <div class="col"><a href=""><img src="images/Lakers/L1000883.JPG" alt=""></a></div>
        <div class="col"><a href=""><img src="images/Others/1.jpg" alt=""></a></div>
        <div class="col"><a href=""><img src="images/Others/2.jpg" alt=""></a></div>
        <div class="col"><a href=""><img style="object-position: 60% 0%;" src="images/About/About me.jpg" alt=""></a></div>
    </div>

and here is the relevant CSS:

.container-fluid{
    padding: 0 !important;
    margin: 0  !important;
}
img{
    padding: 0 !important;
    margin: 0  !important;
    height: 350px;
    width: 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    object-fit: cover;
    object-position: 60% 30%;

}

Answer №1

col class typically includes padding-left: 15px and padding-right: 15px by default. To eliminate this padding, you can utilize the p-0 Bootstrap class:

<div class="container-fluid">

    <div class="col p-0"><a href="about.html"><img style="object-position: 60% 0%;" src="images/Life/1.jpg" alt=""></a>
    </div>
    <div class="col p-0"><a href=""><img src="images/Life/3.jpg" alt=""></a></div>
    <div class="col p-0"><a href=""><img src="images/Lakers/L1000857.JPG" alt=""></a></div>
    <div class="col p-0"><a href=""><img src="images/Lakers/L1000883.JPG" alt=""></a></div>
    <div class="col p-0"><a href=""><img src="images/Others/1.jpg" alt=""></a></div>
    <div class="col p-0"><a href=""><img src="images/Others/2.jpg" alt=""></a></div>
    <div class="col p-0"><a href=""><img style="object-position: 60% 0%;" src="images/About/About me.jpg" alt=""></a>
    </div>
  </div>

Learn more about spacing here

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

Display the column every time the user types something into the search bar

Currently working on an Angular project and I'm trying to figure out how to make the middle column visible whenever the user enters text in the search bar. At the moment, I have a search bar for user input and three flex columns. The middle column is ...

Utilizing media queries to customize the appearance of a jQuery accordion widget

Hello, I'm struggling with implementing a jQuery accordion for mobile platforms that destroys itself on larger screens. While my code is mostly working, I've encountered two issues: The accordion only gets destroyed when the window is resized ...

Utilizing APEX for Node JS speech synthesis

I am attempting to send a string from my APEX site to a Node.js web server using the following code: tts = require('node-tts-api'); express = require('express'); var app = express(); app.all('*', function(req, res, next) { ...

responsive full-screen navigation bar, combined with an image and text elements

I am completely new to Front end development, and this is my very first client project where I could really use some assistance. Could someone please guide me on how to ensure that everything on the website is responsive for mobile and tablet devices? Be ...

Modify the data in Firebug and access it using jQuery's html() method

I have a scenario where I am trying to access the original value of a <span></span> element that has been changed using Firefox Firebug. When I use $("span").html(); it returns the modified value instead of the initial value set when the ...

Is it necessary to restart the IIS Site when altering the contents of index.html?

I am currently working on updating a website that runs on a Custom Designed CMS with files using the .asp extension. The site seems to be quite dated and is hosted on an IIS Server, which I do not have direct access to. The user has requested some changes ...

Is iOS Safari preloading entire MP4 videos before playback?

After conducting a test on our homepage using www.webpagetest.org, I found that the autoplay HTML5 9MB fullpage background video loads quickly and plays smoothly on Windows Chrome. However, iOS Safari takes around 23 seconds to load as it waits for the ent ...

Eliminating classes with jQuery through the use of logical operators

I have been trying out some experiments and I got curious if there is a way to eliminate a class from a div in all divs except the specified one: $(function() { $('#tab-2').click(function() { ...

Is it necessary for two sibling elements to be of the same type in order for their margins to collapse together?

I am currently working on enhancing the visual appearance of a Bootstrap 4 card and encountered an issue: https://i.stack.imgur.com/p8Qzhm.png The spacing between the About the gig heading and the top Date item appears to be uneven. I would like to make ...

What is the best way to hide the CSS tooltip box once it has been hovered over?

I currently have some external CSS code obtained from W3Schools: /* Tooltip container */ .tooltip { /*position: relative;*/ display: inline-block; } /* Tooltip text */ .tooltip .tooltiptext { visibility: hidden; width: 120px; backgrou ...

Writing HTML and PHP code simultaneously on a single page is not possible

I'm currently working on a PHP form code that I've written on the same page as HTML. The file is named signup.php, but I keep encountering this error: Notice: Undefined index: nm in C:\xampp\htdocs\mini_project\signup2.php ...

Change the color of the Parent Menu when a childMenu is clicked on using CSS and HTML

<li class="btn-group" mdbDropdown> <a mdbDropdownToggle id="ParentId"> <i class="nav-item"></i> MainMenu <i class="fa fa-angle-down"></i> </a> <div class=" ...

Tips for concealing a dynamic table element in Angular 9

I have dynamically generated columns and rows in a table. Here is my HTML for the table component: <table id="tabella" class="table table-striped table-hover"> <thead class="thead-dark"> <tr> <th *ngFor="let header of _ob ...

How come the cubic bezier timing function works flawlessly just on the first try when staggered transitioning element opacity over time with CSS and a touch of JS?

I'm currently working on a menu overlay that expands to fill the screen when a user clicks a button in the corner. I'd like the menu items to fade in one by one, similar to the effect used on this website: Most of the functionality is there, but ...

Transition effects in CSS when hovering

I've run into an issue where I'm attempting to create a hover transition effect on a div when the mouse hovers over it. The idea is that hovering over the main div should trigger another div to appear above it, with a smooth transitioning effect. ...

Utilizing personalized markers to encapsulate correct HTML elements

Recently, I came across a discussion on the implications of using custom tags in HTML. After reading about it, I have decided to avoid using custom tags in order to adhere to standards and ensure that search engine bots can properly read my code. However, ...

Why is text overlapping padding in Bootstrap 4? What can be done to prevent this issue?

I've set up a basic bs4 layout where the left-menu is represented by <div class="col-md-2">, the center-main-content by <div class="col-md-6">, and the right-menu by <div class="col-md-4">. Using Chrome ...

Tips for matching the width of tooltips with the length of the title

I am trying to adjust the width of the antd tooltip to match that of the title. Here is the code snippet: <Tooltip placement="top" align={{ offset: [0, 10] }} title='this is the title'> <span>tooltip</span> </T ...

When scrolling, apply a CSS class to a div element once it becomes visible on the

I'm in the process of developing a timeline feature for my website, and I am facing an issue where the addClass function is being applied to all sections, even those that are not currently visible on the screen during scrolling. If you would like to ...

Fluid animation using CSS for recently added elements in a scrolling list

I've been searching for a way to create a smooth animation effect when a new element is added to a scrolling list. For example, as a new element is added to the top of the list and older elements are pushed down, I want the transition to be visually ...