Link to home
Start Free TrialLog in
Avatar of jagr12
jagr12

asked on

Bootstrap - table width

I want to create a table using Bootstrap. How can I set a width of this table? Right now, it stretch across a web page?

<table class="table table-bordered">
                <thead>
                    <tr>
                       
                        <th>Header</th>
                     
                    </tr>
                </thead>
                <tbody>
                    <tr>
                       
                        <td>John</td>
                       
                    </tr>
                   
                </tbody>
            </table>
Avatar of Montoya
Montoya

in bootstrap it's all about rows and columns. Your columns are based on a value of 12, so you want to set the column based on the viewable area (large, medium, small, xsmall, etc..) then your columns would be based on that 12 value. 2 columns with a 6 value would be half the width each. 3 columns with a 4 value would be 1/3 width each.

You can adjust based on your needs.
Use for example:

 <div class="col-md-6">

And you have half the page
Avatar of jagr12

ASKER

It is possible to center this able too?
ASKER CERTIFIED SOLUTION
Avatar of Tom
Tom
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jagr12

ASKER

Thank you gentlemen
Alternative to creating empty <div>
<div class="col-md-6 col-md-offset-3">
   <table ....>
</div>

Open in new window

More info on the Bootstrap site
http://getbootstrap.com/css/#grid-offsetting