UIKit Basic Table
To create UIkit basic table, add .uk-table
class to the <table>
element base class
Example
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
UIkit table provides different predefined table classes that are used to create nice looking table having different styles.
To create UIkit basic table, add .uk-table
class to the <table>
element base class
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
Source Code
<table class="uk-table">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Jhon Smith</td>
<td>Designer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Doe</td>
<td>Developer</td>
</tr>
</tbody>
</table>
Source Code: Output
The above source code result will be:
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
The predefined class .uk-table-divider
is used to create a divider between tables rows.
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
Source Code
<table class="uk-table uk-table-divider">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Jhon Smith</td>
<td>Designer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Doe</td>
<td>Developer</td>
</tr>
</tbody>
</table>
Source Code: Output
The above source code result will be:
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
To create UIkit table stripped row, add .uk-table
& uk-table-striped
class to the <table>
element base class.
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
Source Code
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Jhon Smith</td>
<td>Designer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Doe</td>
<td>Developer</td>
</tr>
</tbody>
</table>
Source Code: Output
The above source code result will be:
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
To add table hover effect, simply assign .uk-table
& .uk-table-hover
class to the <table>
element base class.
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
Source Code
<table class="uk-table uk-table-hover">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Jhon Smith</td>
<td>Designer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Doe</td>
<td>Developer</td>
</tr>
</tbody>
</table>
Source Code: Output
The above source code result will be:
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
To create a responsive table, simply wrap the table inside the container having class .uk-overflow-auto
.
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |
Source Code
<div class="uk-overflow-auto">
<table class="uk-table uk-table-hover">
<thead>
<tr>
<th>Name</th>
<th>Job</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Jhon Smith</td>
<td>Designer</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>John Doe</td>
<td>Developer</td>
</tr>
</tbody>
</table>
</div>
Source Code: Output
The above source code result will be:
Name | Job |
---|---|
Jhon Smith | Designer |
John Doe | Developer |