Tips for stacking columns with Twitter Bootstrap?

Looking to design a layout with 3 columns:

Column 1 (span 3) - Column 2 (span 8) - Column 3 (span 3)

I want Column 2 to partly overlap with Column 1 and Column 3 on each side, all within the same row. What would be the most effective method to achieve this using the responsive grid system of Twitter Bootstrap?

Answer №1

You have three choices to explore:

  • Consider using Twitter Bootstrap v1.XX where the grid consisted of 16 columns instead of 12, allowing you flexibility with two extra columns.

For reference, here are the old documentation links for version 1.4.0:

To access the v1.4 bootstrap files, visit: https://github.com/twitter/bootstrap/zipball/v1.4.0


  • Create a customized Bootstrap v2.XX build tailored to your needs.

Use this link to customize and generate a unique build:

Note: If you opt for customization, you may need to adjust the 'span*' organization in your HTML file to accommodate the change to 14 or 16 columns, along with new margin/padding values.

(Special thanks to @jmeas for highlighting the Customization feature).


  • If you anticipate overlapping elements, stick to the default build and utilize the following technique.

One method is to use the offset* class and create a corresponding offset-* with a negative value.

Sample HTML code:

<div class="container">
    <div class="row-fluid">
        <div class="span3">xx</div>
        <div class="span8 offset-1">yy</div>
        <div class="span3 offset-1">zz</div>
    </div>
</div>

Corresponding CSS styles:

.row-fluid .offset-1 {
    margin-left: -10.638297872340425%;
    *margin-left: -10.53191489361702%;
}
.row-fluid .offset-1:first-child {
    margin-left: -8.51063829787234%;
    *margin-left: -8.404255319148938%;
}

Check out the Fiddle where I've included RGBA colors to showcase overlapping elements within the '12-grid' structure.

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

Is there a way for me to enable autoplay on the Slice Slider?

I'm struggling to enable autoplay on a slider I have here. Is it possible to quickly set this up in the var settings? I attempted to insert the setInterval(spin, 3000); command before and after the init lines, but it hasn't been successful so fa ...

Unveil concealed information within a freshly enlarged container

As I organize my content into an FAQ format, I want users to be able to click on a link and expand the section to reveal a list of items that can also be expanded individually. My goal is to have certain list items expand automatically when the FAQ section ...

Tool for controlling the layout of the viewport with Javascript

I have experience using ExtJS in the past to create dashboards, and one of my favorite features is the full-screen viewport with a border layout. This allows for easy splitting of a dashboard into panels on different sides without creating excessive scroll ...

Is it possible to change the CSS styling of a specific DIV class that contains nested anchor tags using jQuery?

The HTML: <div id="main_menu"> <a id="menu_item_articles" href="articles">articles</a> </div> The CSS: #main_menu { float: left; padding-top: 10px; vertical-align: middle; text-align: center; width: 500px; ...

Implementing JavaScript to add elements to class

Is there a way to use JavaScript to dynamically add classes to elements? <div class="col-md-4 col-xs-6 work-item web-design" id="SetCategory"> . . <script> document.getElementById("SetCategory").classList.add('{{ $category->nam ...

Height set at 100% but not extending to the entire parent element

I've applied min-height: 100vh; to the body, and then height: 100% to the main element. However, the height of the main does not extend fully to its parent container. Could someone please help me understand why this is happening? Thank you. I'v ...

Designing a unique pagination layout for your WordPress website

Currently, I am working on a WordPress project. I have created my own template using CSS and HTML format. The implementation is going well, but I am facing difficulty integrating WP pagination design into my template. Below is the pagination code from my ...

Creating Unique Spacing in Bootstrap Using Concise Text

https://i.sstatic.net/uZ4CD.png Trying to align the bullet point text with others can be a challenge, especially when the text does not span multiple lines. The bullet point in this case is an image. Concerns html and css .description-row { margin- ...

Tips for showcasing chats with the most recent message highlighted

As I work on my web app using Laravel, I have encountered an issue where I need to scroll down to see the newest messages when there are many conversations. Here is how the chats display on page load I want to focus on displaying the newest message first. ...

Issue with HTML/CSS: rectangle doesn't scroll as expected

I'm in the process of developing a new website and I want to include a top bar and footer with some unique elements on it. Additionally, I am looking to create a rectangular area where I can input text. After writing the following code snippet, this ...

Troubleshooting issue with changing class based on input values

It appears that there is an issue with the functionality when switching values on page load. Initially, I was able to make it work for a single switch, but now that there are multiple switches on the page, toggling affects all of them. How can I modify it ...

Issues with Swiper functionality in Jquery Mobile

I have implemented the Swiper plugin by idangero.us along with jQuery Mobile... In this case, I am utilizing the Scroll Container Swiper for a content slider... However, I am encountering several difficulties when trying to integrate the code... You can ...

Using JQuery to create a checkbox with dual functionality within a function

I'm struggling to create a versatile checkbox that will toggle the display of a div from none to block when checked, and back to none when unchecked. I attempted to implement a conditional statement: $("#customCheck1").on("change", function() { if ...

"Troubleshooting: Why is :last-child not applying styles to my final

I'm encountering an issue in my example where the last </li> doesn't display properly when using :last-child. In the provided code, you can observe that when I target the last element with the class "aa," it shows the "+ Add" text. &.a ...

Every click will nudge the square to the right

I have a square that should move 100px to the right when clicked, but on the next click it moves back to the left. How can I resolve this issue? On JSFiddle, the code works fine. However, when I try to run it in Chrome, I get an error message: Cannot re ...

Issue with Bootstrap 5.1 scrollspy not activating on list group items

Looking for a solution to a bootstrap scroll spy issue. Despite copying the example directly from the documentation, I can't seem to get it to work properly! https://getbootstrap.com/docs/5.1/components/scrollspy/ The anchor links are functioning co ...

Exploring the concept of overflow and minmax behavior in CSS grid

Summary: Example of overflow in nested grid layout on Codepen, and attempts to fix it using CSS grid-template-columns: repeat(16, minmax(0,1fr)); Within the element called container, there are two main elements - summary-wrapper and stats-wrapper The gri ...

Choosing from a variety of tr elements

I'm working with a table in HTML that has about 100 rows. I would like to apply different colors to specific groups of rows, such as making rows 1-10 red and rows 20-40 blue. Using nth-child seems like an option, but it can get quite verbose if I nee ...

When you refresh the page, the number of items in the cart displayed on the navbar always shows 0

When using my angular application, I encountered a problem with adding movies to a cart. Although I can successfully add them to the cart and see the correct number of movies reflected in the navbar, upon refreshing the page, the count resets to 0. Here i ...

Adding a gap between the Bootstrap navbar and jumbotron for better spacing

Upon examining the Bootstrap example provided at: http://getbootstrap.com/examples/navbar/ I noticed there is a gap between the jumbotron and the navbar. After delving into the example's CSS, I found that disabling this rule (twice): .navbar { ...