Solved

Bootstrap - table width

Posted on 2016-08-24
7
19 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:Iammontoya
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:Iammontoya
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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 51

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now