Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap grid with something like colspan

How do I create this layout with Twitter Bootstrap...

enter image description here

So that it stacks like this ...

enter image description here

I could do the layout as a table (currently it's an image map, but that was a quick and dirty short term solution), but as I understand bootstrap, the table wouldn't know how to stack the cells. I've seen a number of Bootstrap demos that give "rowspan" like functionality, but in this case I need a "colspan" like function. Can Bootstrap do this?

like image 512
nedlud Avatar asked May 05 '14 06:05

nedlud


People also ask

How do I customize Bootstrap grid?

The Bootstrap grid allows 12 columns with 30 px wide gutters by default, but these numbers can be adjusted. Just check the Grid System block on the Customize page. The @grid-columns field allows to set a different number of columns, and the @grid-gutter-width field lets you change the gutter width.

Does Bootstrap 5 Use flexbox or grid?

Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content. It's built with flexbox and is fully responsive. Below is an example and an in-depth explanation for how the grid system comes together.

Can you use Bootstrap with grid?

Bootstrap has a responsive grid system, with custom breakpoints. It offers a mobile-first design that makes a single code scale for multiple devices like phones, tablets, and desktops.

Is CSS grid better than Bootstrap?

If we want to place the content precisely on a page, then CSS Grid is better, but if we want the flexibility of the layout, then we should go for Bootstrap.


1 Answers

Assuming you want to use Bootstrap 3.1.1 something like this should work. You might have to add some tweaks but it should solve your problem. Basically you put your subheaders and your content blocks together in one column each, so that the stick together on smaller screens.

<div class="container">
    <div class="row">
        <div class="col-xs-2">
            3
        </div>
        <div class="col-xs-10">
            <div class="row">
                <div class="col-sm-12">
                    Research complete
                </div>
            </div>
            <div class="row">
                <div class="col-sm-4">
                    <div>Protocol and data</div>
                    <div>
                        <ul>
                            <li>...</li>
                            <li>...</li>
                            <li>...</li>
                        </ul>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div>Study specific</div>
                    <div>
                        <ul>
                            <li>...</li>
                            <li>...</li>
                            <li>...</li>
                        </ul>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div>Ethics/governance and regulatory</div>
                    <div>
                        <ul>
                            <li>...</li>
                            <li>...</li>
                            <li>...</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

JSFiddle

like image 130
Syjin Avatar answered Sep 20 '22 04:09

Syjin