What is the true functionality of the Bootstrap Grid system?

I am currently in the process of grasping how this functions.

As an example, I have created columns and inserted <hr> for visualization purposes.

This is what I have attempted thus far:

I adjusted the row's margin to be -15px on both sides. Columns were given padding of 15px on left and right.

The widths are similar to those used in Bootstrap.

All columns are floated to the left.

However, I am puzzled as to why my layout isn't working properly. When attempting to create 4 columns, only 3 appear with the fourth dropping down below. The widths seem accurate but it's still not displaying correctly. Feeling a bit frustrated.

Edit:

HTML

<div class="row">
 <div class="column">
  <hr>
 </div>

 <div class="column">
  <hr>
 </div>

 <div class="column">
  <hr>
 </div>
</div>

CSS

.row {
margin-left: -15px;
margin-right: -15px:
}

.column {
padding-left: 15px;
padding-right: 15px;
float:left;
width: 33.33333%
}

Answer №1

Your layout may not be working the same as Bootstrap because Bootstrap utilizes the border-box sizing method. To achieve a similar result with your layout, you can implement the following CSS code:

* {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

.row {
  margin-left: -15px;
  margin-right: -15px:
}

.column {
  padding-left: 15px;
  padding-right: 15px;
  float: left;
  width: 33.33333%
}

http://www.example.com/go/ABC123

Answer №2

Not quite sure what your goal is, but it appears you are aiming for 3 columns?

Give this a shot:

<div class="row">
    <div class="col-md-4">
        1 / 3
    </div>
    <div class="col-md-4">
        2 / 3
    </div>
    <div class="col-md-4">
        3 / 3
    </div>
</div> 

Here's a little explanation: col-md-12 represents one column

So if you need 2 columns, use col-md-6 (twice, and always within a row class)

And the same principle applies with any other number of columns.

You might find this helpful to read through: http://getbootstrap.com/css/#grid

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

What causes the variation in default margin between React and traditional HTML?

There seems to be a difference in margin between <button> elements when rendered by React compared to plain HTML. Plain HTML adds a small margin between the buttons, while React removes it completely. Does anyone have an explanation for this discrep ...

Space within a series of photographs

Looking for some assistance: I am trying to maintain a consistent margin of 10px between posts and between photos in a photoset. However, when a post is a photoset, the margins of the bottom photo and the overall post add up to 20px. I want to retain the ...

Is there a way to change TextBox multiline to uppercase in Opera browser?

Does anyone know how to convert TextBox multiline to Uppercase in Opera? I tried using "text-transform:uppercase" but it only seems to work with IE ...

Material-UI's simplification of 10px comprehension

I'm a bit confused about why we have to do this for the 10px simplification: html { font-size: 62.5%; /* 62.5% of 16px = 10px */ } Shouldn't the following code handle everything? const theme = createMuiTheme({ typography: { // Set the ...

What is the best way to eliminate the lower margin in the UI-Boostrap Angular Tab directive?

The ui.bootstrap.tabs directive, which can be found here, seems to have a default margin before displaying its content. https://i.stack.imgur.com/NECGA.png Here is the HTML snippet: <uib-tabset active="activeJustified" justified="false" id="tabSet" s ...

Scrolling and hovering now triggers the fixed button to toggle class seamlessly

Currently, I am attempting to modify the class of a button on my website. The initial state of the button is wide, but as the user scrolls, it should shrink in size. When hovering over the shrunken button, it should expand back to its original width. Alt ...

Obtaining the text of a span tag within a div using Selenium in C#

<div id="uniqueSummaryID" class="custom-text" data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_key_25.1.1.0"> <span data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_key_25.1.1.0.0">5</span> <span data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_ke ...

To access an RSS feed, use Google Chrome as your browser

I am struggling with my .php script that generates an RSS-Feed on-the-fly. My goal is to attach a .css stylesheet to this script so that browsers lacking a built-in RSS-viewer can properly display the feed. I achieved this using the following code snippet ...

Exploring the position property in CSS

Seeking assistance as a CSS beginner. Currently working on a project where I have managed to position container_main right next to container_menu, utilizing the remaining screen space by assigning them relative and fixed positions, respectively. container ...

Simple Design Techniques for HTML Tables

I seem to be having trouble with the table styles when I include text in the <td> section: <td rowspan="3"> 30th May 2014 17:35... What could be the issue? <style type="text/css"> .tftable {font-size:12px;color:#333333;width:100%;borde ...

What are the steps for utilizing CSS Global Variables?

Hey there, thank you for taking the time to help me out. I'm having a simple doubt that I just can't seem to figure out. So... here's my '/pages/_app.js' file: import '../public/styles/global.css'; export default funct ...

Animating a Bootstrap 4 card to the center of the screen

I am attempting to achieve the following effect: Display a grid of bootstrap 4 cards Upon clicking a button within a card, animate it by rotating 180 degrees, adjusting its height/width from 400px - 350px to the entire screen, and positioning it at the c ...

The beauty of Aurelia's scoped CSS

Embarking on my Aurelia journey, I find myself navigating through the vast world of web development with tools like nodejs, gulp, and more. The Aurelia CLI has made it convenient for me to set up a visually appealing Aurelia project in Visual Studio Code ...

What is the best method to eliminate unnecessary space between controls in HTML?

Presently, I am facing the following scenario. http://jsfiddle.net/ef7vh/1/ </p> <pre> <div> <button>Button1</button> <span style="border: solid 1px black; padding: 0px 10px 0px 10px">My Text</span> < ...

Ways to incorporate React.js into HTML for showcasing a portfolio

Having difficulties rendering my code using React.js for my portfolio. I am attempting to showcase my projects with images and p tags containing project titles and my role. Additionally, I would like the React elements to be clickable, directing users to t ...

Creating a protective boundary for images and text in HTML

<!DOCTYPE html> <html> <head> <title>Homepage</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <body style="background-color:#38a9e3;"> <link rel="styl ...

Prevent webpage from resizing when window dimensions change

Whenever I resize my webpage window, the elements start to pile on top of each other and it looks disorganized. For example, when I reduce the window size, YouTube just cuts off everything instead of stacking the images. How can I achieve a similar effec ...

Align text within HTML with the use of Bootstrap

Example data value category type item1 100 food fruit item2 50 drinks soda item3 75 snacks chips I want to achieve this forma ...

Increasing the position of a div using Django

Currently, I am working on a website project for a client who wants to incorporate a unique feature which involves having a very wide but not very tall page. One challenge I am facing is the placement of a list of objects on the page in a way that they co ...

Django's background image remains static regardless of CSS changes

I recently downloaded an HTML template and am attempting to customize it by changing the background image within the CSS file. The current code in the CSS file is as follows: background: url(../img/background.jpg) Despite my efforts to replace it with t ...