• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

3 Column Table HTML & CSS

The HTML & CSS in this tutorial generate a very simple 3 column table like this :

There’s only 2 steps needed to install the table in any WordPress theme.

Step 1 : Add the following HTML to your WordPress editor.

<table class="wp-table">
    <tr>
      <th>First Name</th>
      <th>Surname Name</th>
      <th>Score</th>
    </tr>
    <tr>
      <td>Matt</td>
      <td>Pearson</td>
      <td>99</td>
    </tr>
    <tr>
      <td>Steve</td>
      <td>Smith</td>
      <td>64</td>
    </tr>
    <tr>
      <td>Brian</td>
      <td>Johnson</td>
      <td>16</td>
    </tr>
  </table>

Step 2 : Add the following CSS to your child themes style.css file.

.wp-table tr:nth-child(odd) {
    background-color: #fff;
}

.wp-table tr:nth-child(even) {
    background-color: #f1f1f1;
}

.wp-table tr {
    border-bottom: 1px solid #ddd;
}

.wp-table th:first-child, 
.wp-table td:first-child {
    padding-left: 16px;
}


.wp-table td, 
.wp-table th {
    padding: 8px 8px;
    display: table-cell;
    text-align: left;
    vertical-align: top;
}

.wp-table th {
    font-weight: bold;
}
 
.wp-table {
    font-size: 13px!important;
    border: 1px solid #ccc;
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    display: table;
}

Tested using the Genesis Sample child theme by StudioPress.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems