Solved

Bootstrap - table width

Posted on 2016-08-24
7
27 Views
Last Modified: 2016-08-25
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>
0
Comment
Question by:jagr12
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 19

Expert Comment

by:Montoya
ID: 41769523
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.
0
 
LVL 19

Expert Comment

by:Montoya
ID: 41769525
0
 
LVL 9

Expert Comment

by:Tom
ID: 41769529
Use for example:

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

And you have half the page
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:jagr12
ID: 41769536
It is possible to center this able too?
0
 
LVL 9

Accepted Solution

by:
Tom earned 500 total points
ID: 41769541
<div class="col-md-3">
</div>

 <div class="col-md-6">
center content
</div>

 <div class="col-md-3">
</div>
0
 

Author Comment

by:jagr12
ID: 41769548
Thank you gentlemen
1
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 41769850
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
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question