Bootstrap: Troubleshooting Margin Problems

I am currently utilizing the Bootstrap sb admin template. I attempted to include 3 columns in a row, but encountered the issue of them being merged together with no space around them. I experimented by modifying the Bootstrap file through a CDN link and progressively removing CSS files, yet none of these solutions proved successful. Below is my HTML structure (Codeigniter view):

 <div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header"> Services </h1>
        </div>
    </div>
    <div class="row">
        <div class="col-md-3 col-sm-3 col-xs-12 service-block">
            <img src="<?php echo base_url()?>assets/images/service-1.png" class="img-responsive  center-block">
            <h3 class="text-center">Body Works</h>
        </div>
        <div class="col-md-3 col-sm-3 col-xs-12 service-block">
            <img src="<?php echo base_url()?>assets/images/service-1.png" class="img-responsive  center-block">
            <h3 class="text-center">Body Works</h>
        </div>
        <div class="col-md-3 col-sm-3 col-xs-12 service-block">
            <img src="<?php echo base_url()?>assets/images/service-1.png" class="img-responsive  center-block">
            <h3 class="text-center">Body Works</h>
        </div>

    </div>
    <!-- /.row -->
</div>

The following snippet represents the CSS styling for these service blocks:

.service-block{
        background: #EDEDED;
        height: 220px;
     }
    .service-block img{
        margin-top: 15%;
        margin-bottom: 9px;
    } 

By referring to the output image linked below, you can observe how the services appear without the desired spacing:
https://i.sstatic.net/qr25J.png

If anyone has insights or suggestions on how to resolve this layout issue, your assistance would be greatly appreciated.

Answer №1

In one row, you currently have 3 columns each occupying 3 spaces in the grid, totaling 9 spaces. However, Bootstrap necessitates that you fill 12 spaces in total. To adhere to this requirement, consider using the following code snippet:

<div class="col-md-4 col-sm-4 col-xs-12 service-block">

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

JavaScript code for modifying style properties

Is there a way to modify this function so that when the heading is changed successfully, a "Change Back!" button appears? And then, with a click on the button, the heading is reset and the button disappears again. function changer () { var textArea = ...

Navigating through sibling elements can be accomplished by using various methods in

Can someone help me figure out how to assign unique IDs to 6 different Div elements as I step through them? The code snippet below is not working as expected, giving all Divs the same ID. What is the correct way to accomplish this task? $('#main-slid ...

What are the steps to executing commands with child processes in Node.js?

I have successfully established communication between the client and server using socket.io. I am now utilizing WebSockets to send commands from the client to the server, and I would like to execute these received commands on the server. Here is my approa ...

Problem with CSS creating the Typewriter effect when the third line of text is added

I've been working on a website for my new company and I want to incorporate a typewriter effect on the main page. I came across a tutorial on Medium.com but I'm having trouble adding an additional span to the provided code. Take a look at the lin ...

The functionality of Vue is acting up with the HTML, unexpectedly refreshing when a button is clicked

I am currently experiencing an issue with my Vue application. When I click the button, it clears the input field (which it shouldn't) and doesn't perform any other actions. The variables "codigo" and "payload" do not display anything on the scree ...

I'm having trouble getting the "spacing" styling attribute to work in Material UI when I attempt to space out elements within my Box component. Can anyone explain why this might be happening?

Within my React 16.10 application, I am utilizing materialUI components. Specifically, I have incorporated two buttons inside a Box element. <Box style={{ marginTop: "3rem", marginLeft: "1rem", display: "f ...

What is causing the text to not wrap around properly?

I'm currently facing an issue where the text that should not wrap around the image is wrapping, while the text that should be wrapped isn't. This is causing a layout problem in my coding section as shown here: The desired layout is to have the i ...

Utilizing jQuery to execute a particular task based on the selection of a radio button

I have implemented a few radio buttons using bootstrap, as shown below. <div class="btn-group" data-toggle="buttons"> <label class="btn btn-primary"> <input type="radio" name="options" id="option1"> Option 1 </label> <label cla ...

jsx eliminate parent based on dimensions

Imagine I have a DOM structured like this <div className="parent"> <div>child 1</div> <div>child 2</div> </div> If the view is on mobile, I would like the DOM to transform into <div>child 1</ ...

Struggling to locate the element using xpath on a JavaScript enabled website in Selenium with Chrome

I have been attempting to extract data from a website that utilizes Javascript. Despite researching similar inquiries on xpath in Selenium, I have not found a solution. I initially tried using requests, but as the JavaScript doesn't load completely, I ...

The movement of the Bootstrap navbar brand causes a shift in adjacent elements

Is there a way to use the bootstrap navbar brand without it affecting the layout of other elements? I'd like to have the icon aligned to the left and the navbar elements perfectly centered. Alternatively, is there a way to include the element as a n ...

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& ...

Ways to ensure that the height of the second row in the second column matches that of the first column

My current layout design is causing an issue where the lower green box extends beyond the total height of the entire box. I've provided a rough version of my code on codepen. Using the Bulma framework, my goal is to align the height of the left column ...

Is it more efficient to employ jQuery with the form submission button?

Would using JQuery for form submission be the optimal choice? For instance: <input type="text" id="username" name="username" maxlength="30" /><br /> <input type="password" id="password" name="password" maxlength="30" /><br /> <i ...

Can you explain the significance of the characters '& > * + *' in JSX (CSS)?

When using material UI, the progressbar demo includes lines of JSX code like this: '& > * + *': { marginTop: theme.spacing(2), }, Can you explain what the selector '& > * + *' represents in this context? ...

Utilizing PHP for file uploading and inserting the file path into a MySQL database

FileUpload.php: <?php //Directory to save uploaded images $targetDir = "img/"; $targetFilePath = $targetDir . basename($_FILES['uploadedFile']['name']); //Get form data $fileName = $_POST['uploadedFile']; $fileDescriptio ...

Creating a function that allows for the dynamic addition of rows in Angular with

I am currently working on implementing search and filter functionality, which requires adding rows dynamically. With hundreds of fields to filter, my boss has decided to organize them in dropdown menus (such as Manager, City, and Name in this example). The ...

Struggling to remove the image tag from the jQuery ajax response

My web app is designed to send an ajax post request to a PHP script, which then returns a chunk of HTML data. This HTML includes an image and a table of information. The challenge I'm facing is how to extract the image from the rest of the HTML so tha ...

Displaying PHP values in HTML using the print format function

Hey there, I am a beginner in PHP and I'm currently working on displaying values from my SQL table within an HTML article. I have chosen to use the article structure because it fits my needs. Essentially, I want to retrieve the path and username data ...

"Even when hidden, an HTML Div element still occupies space on the

I encountered an issue with my tabbedPage setup. Even though I have hidden content, it still occupies space on the page. Here is the code snippet that I am using: let tabHeader = document.getElementsByClassName("tabbedpage-header")[0]; let tabIndicator = d ...