The Crafty Mummy

Crafts. Sewing. Quilting. Crochet. Tutorials.

  • Start Here
  • Welcome
    • Subscribe
    • About Me
      • Copyright
      • Disclosure
      • Privacy Policies
    • Advertise
    • Sharing
      • Recommendations
      • Shopping & Coupons
      • Books
  • Explore
    • Crafts
      • Beading
      • Kids
      • Paint
      • Storage
      • Christmas Crafts
    • Sewing
    • Quilting
    • Stitching
    • Crochet
      • Yarn
    • Life
      • Food
      • Organisation
    • Blogging
      • How To
      • Social Media
      • WordPress Plugins
      • Photography
  • Tutorials
    • Tips
  • Shop on Etsy
  • Shop on Redbubble

Adjust a HTML Table in a Blog Post

by Tonya Grant |Filed Under: Blogging, How To Tagged With: HTML Get a Weekly Update of all Articles

HTML table tutorial

Last week I wrote about how to create a HTML table in a blog post. Once you’ve mastered the basic table, here’s some ways that you might want to adjust it.

Add lines/ outlines

The lines on your table are called the border. You add the border by putting the border code into the first line of your table code. The number will control how thick the line is so “1” is quite narrow and “”4” is quite thick. If you don’t have the border in the code then your table won’t have any visible border but will have dotted lines in the edit screen so you can see the cells.

<table border=”1″>

Cell Padding

Use this to add space between the contents of the cell and the borders of the cell. Again it can be added into the first line of your table code. The number indicates how much space there will be in pixels, so “10” is 10 pixels of space.

<table cellpadding=”10″>

Add Headings to a HTML Table

Sometimes you may want headings in the first row of your table. Put this in the first row to create the headings:

<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>

Add a caption to a HTML Table

This is like having a heading outside the table. By default, the caption will be at the centre top of your table. If you want it at the bottom, you can add align=”bottom” into the first tag. (Note: this may not work on all browsers so some readers may not see the caption at the bottom.)

<caption>caption text here</caption>

Set the Width of a HTML Table

If you want your table to be a particular width, you can set that with the width code in the first line of the table code. The number is pixels, so “300” creates a table that is 300 pixels wide. You can also set the widths of various columns by adding the width code to the first row of cells. If you don’t add width code, then the cells will all be the same width within the table. For example, if the width of the table is 300, then the two columns would be 150 each by default.

<table  width=”300″>
<tr>
<td width=”100″>Column 1</TD>
<td width=”200″>Column 2</TD>
</tr>
</table>

Header 1 Header 2 Header 3
how to blanket stitch make text button with skitch
How to Blanket Stitch Making a Text Button Clothes Peg Planes
Here’s my Clever Caption

Here’s the code so you can see where I put the extra things in bold:

<table width=”500″ border=”2″ cellspacing=”20″ cellpadding=”10″ align=”center”>
<tbody>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<img class=”aligncenter size-thumbnail wp-image-8864″ title=”blanket stitch button” src=”http://thecraftymummy.com/wp-content/uploads/2012/08/blanket-stitch-button-150×150.jpg” alt=”how to blanket stitch” width=”150″ height=”150″ />
<img class=”aligncenter size-thumbnail wp-image-8437″ title=”skitch text button” src=”http://thecraftymummy.com/wp-content/uploads/2012/07/skitch-text-button-150×150.png” alt=”make text button with skitch” width=”150″ height=”150″ />
<img class=”aligncenter size-thumbnail wp-image-8444″ title=”clothes peg planes button” src=”http://thecraftymummy.com/wp-content/uploads/2012/07/clothes-peg-planes-button-150×150.jpg” alt=”” width=”150″ height=”150″ />
</tr>
<tr>
<td style=”text-align: center;”><strong>How to Blanket Stitch</strong></td>
<td style=”text-align: center;”><strong>Making a Text Button</strong></td>
<td style=”text-align: center;”><strong>Clothes Peg Planes</strong></td>
</tr>
</tbody>
<caption align=”bottom”>Here’s my Clever Caption</caption></table>

 

Two more extras:

Create cells that span two columns

If you want a heading that covers two columns, you can add a “colspan” code. You can also use this to make cells span more than 2 cells by changing the number to 3, 4 or more.

<th colspan=”2″>…</th>

Create cells that span two rows

For a cell that is is as wide as two rows, you can add in a “rowspan” code. Like the colspan code, this can be used to make the cell span more rows as well.

<tr rowspan=”2″>…</tr>

Here’s my table again with those two added:

 

Header 1 Header 3
how to blanket stitch make text button with skitch
How to Blanket Stitch Making a Text Button Clothes Peg Planes
Making a Text Button Clothes Peg Planes
Here’s my Clever Caption

And here’s the HTML code for this table:

<table width=”500″ border=”2″ cellspacing=”20″ cellpadding=”10″ align=”center”>
<tbody>
<tr>
<th colspan=”2″>Header 1</th>
<th>Header 3</th>
</tr>
<tr>
<img class=”aligncenter size-thumbnail wp-image-8864″ title=”blanket stitch button” src=”http://thecraftymummy.com/wp-content/uploads/2012/08/blanket-stitch-button-150×150.jpg” alt=”how to blanket stitch” width=”150″ height=”150″ />
<img class=”aligncenter size-thumbnail wp-image-8437″ title=”skitch text button” src=”http://thecraftymummy.com/wp-content/uploads/2012/07/skitch-text-button-150×150.png” alt=”make text button with skitch” width=”150″ height=”150″ />
<img class=”aligncenter size-thumbnail wp-image-8444″ title=”clothes peg planes button” src=”http://thecraftymummy.com/wp-content/uploads/2012/07/clothes-peg-planes-button-150×150.jpg” alt=”” width=”150″ height=”150″ />
</tr>
<tr>
<td style=”text-align: center;” rowspan=”2″><strong>How to Blanket Stitch</strong></td>
<td style=”text-align: center;”><strong>Making a Text Button</strong></td>
<td style=”text-align: center;”><strong>Clothes Peg Planes</strong></td>
</tr>
<tr>
<td style=”text-align: center;”><strong>Making a Text Button</strong></td>
<td style=”text-align: center;”><strong>Clothes Peg Planes</strong></td>
</tr>
</tbody>
<caption align=”bottom”>Here’s my Clever Caption</caption></table>

Note: When you make the first heading go over two columns, the heading 2 cell is taken out of the code altogether. Likewise, when the “rowspan” code is used, you need to remove a cell in the next row to accommodate that. I have made those rows of code red so you can see them easily.

Enjoy making those HTML tables!

Filed Under: Blogging, How To Tagged With: HTML

« Book Week: Dorothy Costume
Father’s Day is Coming »
Disclosure: There are affiliate links in this post.  This just means that if you click through and choose to purchase something I may get a small commission - at no extra cost to you, of course.  This helps me keep the content here at The Crafty Mummy free for everyone.

I love to chat so please leave me a comment or ask a question.

Don't stress if your comment doesn't appear immediately - sometimes I have to moderate comments thanks to spam visitors, but the comments from real readers will always get published. Scroll down to add your thoughts or ask a question.

Hi! I’m the CraftyMummy

Tonya is the voice behind The Crafty Mummy. She dabbles in lots of different crafts – patchwork, quilting, cross-stitch, scrapbooking, knitting, crochet and sewing. This is the record of projects she has done, and the projects she dreams of getting to! Read More…

Search

  • Email
  • Facebook
  • Instagram
  • Pinterest
  • Twitter
  • YouTube
Shop my Affiliate Favourites

Fat Quarter Shop for Fabric and More

Grab the Sew Sampler Box Here

AccuQuilt for Cutting Machines and Dies

QuiltyBox for Monthly Treats in the Mail

CreativeBug for Craft Classes

Pretty Darn Cute for Blog Designs like mine

Creative Market for Fonts, Images, Themes and More

OzGameShop for All the Games

Adrift for Fashion you’ll Love

Kindle Unlimited Membership Plans

Kindle Book List

Click to shop my kindle book list
Shop my Amazon Influencer Shop
Join the CrochetU and learn to crochet
New to TheCraftyMummy.com? Click here to see more
Blog Tools I use for TheCraftyMummy.com

Grammarly

Aweber for email newsletter

CoSchedule to stay organised and share

Milotree for social media

Genesis for blog framework

FoodiePro is my theme

Hosting with WPEngine

Powered by

Recent Articles

Disclosure: There are affiliate links on this site. This means that I may get a commission if you choose to purchase after browsing via these links - at absolutely no extra cost to you, of course. I only recommend products which I use and love, or that I think will be quality products that will be useful to my readers. It is the affiliate links in this site that help me keep my tutorials free of charge. Thank you!

Looking for something? Search here:

Copyright 2015 The Crafty Mummy · Built using Genesis Framework & Foodie Pro Theme