"Adjusting the Bootstrap slider's width to fit the parent container at the

My slider is not taking up the full width of my container. I've tried setting the CSS properties to 100% width and height, but it doesn't seem to work as expected (see image link below). The slider needs to occupy the entire width of the container (12 columns in lg size). https://i.sstatic.net/vLFvV.png

There is white space visible that needs to be filled.

Below is the code snippet:


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title> Mobtech </title>

        <!-- Include Bootstrap CSS -->
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/style.css">
        <link rel="css/basic-template.css" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet"> <!-- Custom font -->

    </head>
    <body>
        <!--Slider -->
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 col-sm-12"> 

                        <div id="mojslider" class="carousel slide" data-ride="carousel">

                            <!-- Indicators -->
                            <ol class="carousel-indicators">
                                <li data-target="#mojslider" data-slide-to="0" class="active"></li>
                                <li data-target="#mojslider" data-slide-to="1"></li>
                                <li data-target="#mojslider" data-slide-to="2"></li>
                            </ol>
                            <!-- Slides -->
                            <div class="carousel-inner" role="listbox">
                                <div class="item active">
                                    <img src="Images/samsung.png" alt="samsungslide" />
                                    <div class="carousel-caption">
                                        <h1><font face="Roboto Condensed" size="15" color="white"> Samsung Galaxy S7 </font></h1>
                                    </div>
                                </div>
                                <div class="item">
                                    <img src="Images/iphone.png" alt="iphoneslide" />
                                    <div class="carousel-caption">
                                        <h1><font face="Roboto Condensed" size="15" color="white"> iPhone 7 </font></h1>
                                    </div>
                                </div>
                                <div class="item">
                                    <img src="Images/lg.png" alt="lgslide" />
                                    <div class="carousel-caption">
                                        <h1><font face="Roboto Condensed" size="15" color="white"> LG V10 </font></h1>
                                    </div>
                                </div>
                            </div>
                            <!-- Controls -->
                            <a class="left carousel-control" href="#mojslider" role="button" data-slide="prev">
                                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                            </a>
                            <a class="right carousel-control" href="#mojslider" role="button" data-slide="next">
                                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                            </a>


                        </div>

                    </div>
                </div>
            </div>

            <br/>

            <div class="container"> 
                <div class="row">
                    <div class="col-lg-12 bg-greenbackground"> 
                        <div class="col-lg-12 bg-greenbackground">
                            <center><font face="Roboto Condensed" size="6"> Mobtech - always with you! </font></center>
                            <p><font face="Roboto Condensed" size="4"> 
                            Lorem ipsum dolor sit amet, his no postulant liberavisse. At nibh lucilius sed. Omnium latine efficiendi ea vis. Elit facilisis mel et. Eu qui erat tation elaboraret. Ut nec tamquam vocibus urbanitas, euripidis contentiones usu ex, luptatum maiestatis mea cu.

                            Iriure accommodare vim et. Sed alia munere pertinax no. Duo eu sumo possim, nam te omnis offendit, no scaevola oportere his. Ut qui dolor scripserit reprehendunt. Ne sea zril vivendo, duo iudico aliquam laoreet eu, cu nullam essent delectus ius.

                            Pri facer accusam omittam eu, eam id dico prompta recusabo. Vix an suas alia putent, quo utinam deleniti legendos ne. Vis et nibh fugit aliquam. Ex est salutandi interesset, soluta ancillae incorrupte sea ne. Qui id velit dicunt interpretaris, ad option blandit nam. Odio mucius adversarium has at. Duo option intellegebat signiferumque ex, ut oblique detraxit sit.
                            </font></p>
                        </div>
                    </div>
                </div>
            </div>

            <br/>

            <script src="js/jquery.min.js"></script>
            <script src="js/bootstrap.min.js"></script>
    </body>
</html>

Answer №1

An issue arises due to Bootstrap's container having 15 pixels of padding on each side. To resolve this, implement a custom class that eliminates the padding. A straightforward and effective approach is to apply the noPadding class to the same div containing your slideshow's container.

Subsequently, define the following CSS rules:

.noPadding { padding: 0 !important; }

The discrepancy in width between your slider and other sections of the page is because the padding doesn't affect background-color.

Answer №2

By setting the .container: padding: 0;, the width of the

<div class="col-lg-12 col-sm-12"></div>
will increase by 30px. I recommend implementing the following code:

.col-lg12.col-sm-12 {
   padding: 0;
}

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

Transition effortlessly between web pages with subtle fading effects

I want to implement smooth page transition effects between two web domains: mcpixel.co.uk/new and mcpaper.co.uk. I am the owner of both domains. When a link in the header is clicked, I'd like the page to fade transition to the new page without any whi ...

There seems to be a problem with the Bootstrap Container and Container Fluid

I am currently utilizing Bootstrap 3.3.7 and have incorporated buttons to enhance the content on my webpage. Upon using container-fluid, I noticed that it does not expand the content across the entire page but rather confines it to the center area of the ...

Troubleshooting: Bootstrap update functionality is only functional in Debug configuration in Visual Studio

I recently made the switch from Bootstrap 2 to Bootstrap 4, updating the syntax, grids, and other elements. While everything was working fine in debug mode, I encountered an issue when trying to release the website. Even though there were no errors during ...

How to Disable a Dynamically Generated <li> Element Using jQuery on Click Event

Script Query: Creating <li> Elements Dynamically echo '<div class="pagination"><ul>' . "\n"; // Previous Post Link. if ( get_previous_posts_link() ) { printf( '<li>%s</li>' . "\n", get_previ ...

Using jquery ajax to add new rows to a MySQL table at the bottom, creating a repeating pattern

Using AJAX jQuery, I am constantly updating a table with data from a MySQL database at regular intervals. The refresh rate is set to 1 second. Below is the PHP file responsible for successfully creating the JSON data: <?php $servername = "localhost"; ...

Is there a way to move a placeholder to a small label in the top left corner when an input field is being used?

I've been searching for functional code, but everything I've tried so far hasn't worked. Does anyone have expertise in creating this animation using React? ...

Python code snippet for transforming JSON data into an HTML table

Recently, I've been utilizing the JSON library in Python to extract data from JSON files through Python. extractedData = json.loads(jsonfile) While I have a solid grasp on handling JSON files with Python, I am now exploring ways to present JSON data ...

Progress Bar Modules

I am currently working on creating a customizable animated progress bar that can be utilized as follows: <bar [type]="'health'" [percentage]="'80'"></bar> It is functional up to the point where I need to adjust different p ...

When accessing xmlHttp responseText, it displays the contents of the PHP file instead of outputting the results of executing

I have two programs, test.html and test.php test.html: <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js" ...

Changing the border color of a Bootstrap 5 button using custom CSS styling

I have been working on a page to control my amp using various JavaScript libraries. 1.) How can I change the blue border of a selected Bootstrap 5 button to a lighter green without using SCSS? Example: Repository (apologies for the mess, it's not t ...

What is the best way to transfer Javascript variables from an HTML template to a view function in Django?

Currently, I am developing a website using Django. One of the features I'm working on is a form in my HTML page that includes a textbox for users to input their name with a label "Enter your name". Underneath the textbox, there is a submit button. ...

What is the best way to activate a post function using a hyperlink?

I'm struggling to figure out how to call my post function using a link within my navbar. The issue is that I'm working with links in the navbar code, and not sure how to integrate calling the post function with them. Below is the code for my pos ...

Ensure you watch the video until the end before moving to the next carousel in Bootstrap

I need my carousel to pause at the end of each video before transitioning to the next slide. The code I have loops through the media files in my database to create the carousel. <div id="mediaCarousel" class="carousel slide" data-ride="carousel ...

Design a Unique CSS Shape

Do you have any suggestions on how to create this shape using only CSS, without SVG paths? Thank you in advance! Check out the screenshot here ...

Attempting to employ the HTML5 file picker feature within the AppMaker platform

Hey there, I'm currently working on integrating the HTML5 file picker into my AppMaker app. (Since my app needs to run as the developer, I can't use Drive Picker). I've been able to display the file picker in an HTML widget using the follow ...

Having trouble with JavaScript not working when clicking an image and toggling a div?

Why isn't the onclick image and toggle div functionality working with JavaScript? I made the change from: <input type="button" id="Showdiv1" name="Showdiv1" value="Show Div 1" onclick="showDiv('div1')" /> to: <img src="https://d ...

Look for a regular expression that matches numbers ranging from 1 to 31, either with or without a leading

I am in the process of setting up validation on an <input> element to prevent the user from inputting incorrect characters. Currently, I am utilizing ng-pattern for this purpose, which successfully restricts the user from entering invalid characters. ...

a pair of browser windows displaying a web application built with ASP.NET MVC

We are currently in the process of developing an ASP.NET MVC web application for internal use within our organization. Our users' productivity can greatly benefit from having a larger screen space, which is why we have decided to provide each user wit ...

Fuzzy backdrop with razor-sharp edges

In the process of designing a website, I am in need of a header with a blurred background that retains sharp edges. To achieve this effect, I implemented the use of ::before in my CSS code. Current Outcome: (For full clarity, it may be necessary to view ...

Encountering issues with the phaser framework while setting up a server on xampp, faced with errors in javascript and html

Recently, I've been working on a game using Phaser and encountered some issues while trying to run the code in XAMPP. The game's base is located at htdocs/itw/test.html, with the necessary pngs and json file stored in htdocs/itw/assets/. The pngs ...