Latest web development tutorials

Bootstrap Form

Bootstrap provides a clear layout created table. The following table lists some table elements Bootstrap support:

label description
<Table> Adding to form the basis of style.
<Thead> Table container element header row (<tr>), used to identify the table columns.
<Tbody> Table container element in the body of the table row (<tr>).
<Tr> A group appear on a single line in the container element of the table cell (<td> or <th>).
<Td> The default table cell.
<Th> Special table cell, used to identify the column or row (depending on the extent and location). You must use the <thead> inside.
<Caption> About table store content description or summary.

Form class

The following table style tables can be used:

class description Examples
.table Arbitrary <table> Add base style (only horizontal separator) try it
.table-striped In the <tbody> within the form to add zebra stripes (IE8 does not support) try it
.table-bordered Add a border for all table cells try it
.table-hover In the <tbody> within any row enable hover state try it
.table-condensed Make more compact form try it
Joint use of all forms classes try it

<Tr>, <th> and <td> class

Classes The following table can be used to form a row or cell:

class description Examples
.active The hover color application on line or cell try it
.success It indicates a successful operation try it
.info Information representing varying operating try it
.warning It represents a warning operation try it
.danger It represents a dangerous operation try it

The basic form

If you want only with a padding (padding) and basic table level split, addclass.table, as shown in the following examples:

Examples

<Table class = "table"> <Caption> basic table layout </ caption> <Thead> <Tr> <Th> Name </ th> <Th> City </ th> </ Tr> </ Thead> <Tbody> <Tr> <Td> Tanmay </ td> <Td> Bangalore </ td> </ Tr> <Tr> <Td> Sachin </ td> <Td> Mumbai </ td> </ Tr> </ Tbody> </ Table>

try it"

The results are as follows:

The basic form

Optional Form class

In addition to the basic table markup and .table class, and some can be used as a marker to define the style classes. The following will introduce you to these classes.

Striped table

By adding.table-striped class,you will see the streaks on the line <tbody> within, as the following example shows:

Examples

<Table class = "table table-striped" > <Caption> stripes table layout </ caption> <Thead> <Tr> <Th> Name </ th> <Th> City </ th> <Th> password </ th> </ Tr> </ Thead> <Tbody> <Tr> <Td> Tanmay </ td> <Td> Bangalore </ td> <Td> 560001 </ td> </ Tr> <Tr> <Td> Sachin </ td> <Td> Mumbai </ td> <Td> 400003 </ td> </ Tr> <Tr> <Td> Uma </ td> <Td> Pune </ td> <Td> 411027 </ td> </ Tr> </ Tbody> </ Table>

try it"

The results are as follows:

Striped table

Table Border

By adding.table-bordered class,you will see that each element has a border around, and the total is rounded form, as shown in the following example:

Examples

<Table class = "table table-bordered" > <Caption> Table layout frame </ caption> <Thead> <Tr> <Th> Name </ th> <Th> City </ th> th> password </ th> </ Tr> </ Thead> tbody> <tr > <Td> Tanmay </ td> <Td> Bangalore </ td> <Td> 560001 </ td> </ Tr> <Tr> <Td> Sachin </ td> <Td> Mumbai </ td> <Td> 400003 </ td> </ Tr> <Tr> <Td> Uma </ td> <Td> Pune </ td> <Td> 411027 </ td> </ Tr> </ Tbody> </ Table>

try it"

The results are as follows:

Table Border

Hover table

By adding.table-hover class,when the pointer is over the row when there will be a light gray background, as shown in the following examples:

Examples

<Table class = "table table-hover" > <Caption> hover table layout </ caption> <Thead> <Tr> <Th> Name </ th> <Th> City </ th> <Th> password </ th> </ Tr> </ Thead> <Tbody> <Tr> <Td> Tanmay </ td> <Td> Bangalore </ td> <Td> 560001 </ td> </ Tr> <Tr> <Td> Sachin </ td> <Td> Mumbai </ td> <Td> 400003 </ td> </ Tr> <Tr> <Td> Uma </ td> <Td> Pune </ td> <Td> 411027 </ td> </ Tr> </ Tbody> </ Table>

try it"

The results are as follows:

Hover table

Compact Form

By adding.table-condensed class,inline padding (padding) are cut in half, so that the table looks more compact, as shown in the following example. This information is useful when you want to look more compact.

Examples

<Table class = "table table-condensed" > <Caption> streamlined form layout </ caption> <Thead> <Tr> <Th> Name </ th> <Th> City </ th> <Th> password </ th> </ tr> </ Thead> <Tbody> <Tr> <Td> Tanmay </ td> <Td> Bangalore </ td> <Td> 560001 </ td> </ tr> <Tr> <Td> Sachin </ td> <Td> Mumbai </ td> <Td> 400003 </ td> </ tr> <Tr> <Td> Uma </ td> <Td> Pune </ td> <Td> 411027 </ td> </ tr> </ Tbody> </ Table>

try it"

The results are as follows:

Compact Form

Context class

Context class listed in the following table allows you to change the background color of table rows or individual cells.

描述
.active对某一特定的行或单元格应用悬停颜色
.success表示一个成功的或积极的动作
.warning表示一个需要注意的警告
.danger表示一个危险的或潜在的负面动作

These classes can be applied to the <tr>, <td> or <th>.

Examples

<Table class = "table"> <Caption> context table layout </ caption> <Thead> <Tr> <Th> Products </ th> <Th> Payment Date </ th> <Th> Status </ th> </ tr> </ Thead> <Tbody> <Tr class = "active"> <Td> Products 1 </ td> <Td> 23/11/2013 </ td> <Td> to be shipped </ td> </ tr> <Tr class = "success"> <Td> Products 2 </ td> <Td> 10/11/2013 </ td> <Td> The delivery </ td> </ tr> <Tr class = "warning"> <Td> Products 3 </ td> <Td> 20/10/2013 </ td> <Td> to be confirmed </ td> </ tr> <Tr class = "danger"> <Td> Products 4 </ td> <Td> 20/10/2013 </ td> <Td> has returned </ td> </ tr> </ Tbody> </ Table>

try it"

The results are as follows:

Context class

Responsive table

By any.tablewrapped in.table-responsive class,you can have the table to scroll horizontally to accommodate small devices (less than 768px). When viewed on a large-scale equipment is larger than 768px wide, you will not see any difference.

Examples

<Div class = "table-responsive"> <Table class = "table"> <Caption> responsive table layout </ caption> <Thead> <Tr> <Th> Products </ th> <Th> Payment Date </ th> <Th> Status </ th> </ tr> </ Thead> <Tbody> <Tr> <Td> Products 1 </ td> <Td> 23/11/2013 </ td> <Td> to be shipped </ td> </ tr> <Tr> <Td> Products 2 </ td> <Td> 10/11/2013 </ td> <Td> The delivery </ td> </ tr> <Tr> <Td> Products 3 </ td> <Td> 20/10/2013 </ td> <Td> to be confirmed </ td> </ tr> <Tr> <Td> Products 4 </ td> <Td> 20/10/2013 </ td> <Td> has returned </ td> </ tr> </ Tbody> </ Table> </ Div>

try it"

The results are as follows:

Responsive table