Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap max-width columns responsive

I am trying to code a section of a one-page responsive Bootstrap design that has two side-by-side columns of text. The designer wants these two columns to have a max-width, but once it reaches its max, it is no longer centered (as the rest of the content continues to be responsive).

Is there a way around this to still have the two columns of text centered?

Edit: Here is a link to what the code looks like: http://www.bootply.com/119539

like image 535
user3389584 Avatar asked Mar 06 '14 19:03

user3389584


People also ask

How do I change the width of a column in Bootstrap?

Bootstrap table column width You can use one of the following classes to manipulate the width of the columns. Table columns with auto width. Just add the .w-auto class to the table element to set an auto width to the table column. The width of the columns will automatically adjust to the content of the column.

What is the maximum number of columns in Bootstrap?

Bootstrap's grid system allows up to 12 columns across the page. If you do not want to use all 12 column individually, you can group the columns together to create wider columns: Bootstrap's grid system is responsive, and the columns will re-arrange depending on the screen size: On a big screen it might look better with ...

What are the rows&columns of bootstrap grid?

The Rows & Columns of the Bootstrap Grid are the "star of the show" when it comes to Responsive Design. I will tell you all about Grid tiers, media queries and breakpoints in Bootstrap 4.

What are Bootstrap responsive breakpoints?

Bootstrap uses CSS media queries to establish these Responsive Breakpoints. They enable you to control Column behavior at different screen widths. For example: here are 2 columns, each 50% width: The col-sm-6 means use 6 of 12 columns wide (50%), on a typical small device width (greater than or equal to 768 px):


1 Answers

Here try this Bootply. Is this what you are looking for?

<div class="row">
    <div class="col-lg-12">
            <h2 class="center-block">How We Work</h2>

    </div>
    <div class="col-lg-4 col-lg-offset-2">
        <p class="text-justify center-block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce quis nulla nec lacus condimentum molestie.</p>
    </div>
    <div class="col-lg-4">
        <p class="text-justify center-block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. .</p>
    </div>
</div>

h2.center-block{
    text-align:center;
}

p.text-justify{
 max-width:400px;
}

NOTE: You can use col-lg-offset-2 to shift the div by 2 columns.

like image 84
Lokesh Suthar Avatar answered Sep 30 '22 00:09

Lokesh Suthar