the <caption> html tagWebsites by Mark - 7 Woodrush gardens, Carterton, Oxfordshire. OX18 1JE

the <caption> html tag
the <caption> html tag

The <caption> html tag

Overview

The <caption> HTML tag is used to specify a title for a HTML Table. It can only be used once per table and the <caption> tag must appear immediately after the <table> tag. It works equally as well in table based layouts as well as CSS based ones. When text is put between the opening and closing <caption> tag it is displayed as a table caption text.

Basic Usage

<caption>Some table caption text in here</caption>
Any text between the opening and closing tag will be displayed as table caption text.

Advance Usage

It is possible to style and add functionality to the <caption> tag, this is done by adding an attribute to after the caption in the opening <caption> tag
Attributes allowed for the <caption>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<caption id=”header”>Some table caption text</caption>
With all attributes there is a space after the initial caption then the attribute name, then an equal’s sign and the identifier of the attribute in double quotes.
Both id and class attributes refer to CSS styling of the element and is either stored in the <head> of the webpage on in an external file.
With id this usually refers to a single instance on a page where as class usually refers to a repeating element on a page, it is for this reason for the <caption> tag may use either the id or class as an atribute.
The attribute style allows you to include css style information for a single <caption> tag.
The dir attribute allows for left reading and right reading text, lang allows you to specify a language for the tag and title allows you to include extra information for a tag.
It is possible to attach scripts to tags, as well adding functionality to a webpage, these scripts tend to be written in Javascript and therefore outside the scope of this document

Examples

<caption>Some table caption text</caption> – basic usage example.
<caption id=”header>Some table caption text</caption> – table caption text which is styled by the id header.
<caption class=”headerclass”> Some table caption text </caption> – table caption text which is styled by the class headerclass.
<caption id =”header” class=”headerclass”> Some table caption text </caption> – table caption text which is styled by the class headerclass and the id header.
<caption style="color:#F00">Some table caption text</caption> – table caption text which has a custom colour of red.
<caption dir="rtl">Some table caption text</caption> – table caption text where the text reads from right to left.
<caption lang="uk">Some table caption text</caption> – table caption text where the language has been tagged as UK.
<caption title="ptitle">Some table caption text</caption> – table caption text where the tag has been titled ptitle.

Final Thoughts

Touching on just the surface of the <caption> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.

Our blog

Some random stories from our blog.

Keyword use in body text

Overview Google, also know originally as an information engine was set up to locate the information people wanted to find. A HTML webpage has several parts to it, of which the <body> tag contains most of it. It’s in the Body tag section which the web browser shows what is considered as the webpage. It is therefore no surprise that Google looks as this aspect when deciding on how to rank a webpage. History of the <body> tag The <body> tag is one of the core HTML tags which have been within HTML pages since day one. Most of code used to display a page is contained within this section. It is for this reason Google places great weight on the content within this section. To some degree Google has now gone full circle with its approach. In the beginning pretty much only the on page copy was considered for…

Age of web site

Overview The age of the website has been a ranking fact for many years and with the recent change of direction of Google, this would appear to becoming a more important factor again. The importance of the age of websites Google has always looked at ways to quantify the quality of information on every website it visits. The phrase ‘content is king’ is well known and it is for this reason Google places great deal of time and resources working out which sites information are the most accurate for the search terms people use to search on. Over the last decade the cost of domains and the hosting has become cheaper, and for those with no money there are options which allow for free webpages. A more recent trend off the back of this direction has been the blog for money generation. In short you can get paid for placing…

The <h3> html tag

Overview In HTML h tags stand for heading and this is split into 6 different h tags (h1, h2, h3, h4, h5 and h6). The <h3> tag itself is considered to be a medium repeating sub header for a webpage. By default it is displayed slightly larger than the body text but smaller than the <h2> header. As with all h tags it is considered important for SEO.When text is put between the opening and closing <h3> tag it is displayed as a Medium heading. Unlike <h1> a <h3> tag can be used multiple times on a webpage as its job is to be the heading for a web pages sub topics. Basic Usage <h3>Medium header text</h3> Any text between the opening and closing tag will be displayed as a medium heading. Advance Usage It is possible to style and add functionality to the <h3> tag, this is done by…

MasterCard’s master plan to take over the world.

In recent years supermarkets like Tesco’s have been offering more than just food. They now offer everything from electrical, personal finance and even in one case the ability to buy your next home. With MasterCard’s recent decision to enter the arena of online retailer, is this a good thing for consumer or in a tricky credit market, is it a way for companies like MasterCard to reduce risk and make bumper profits? The vanishing high street 1995 saw the online birth of Seattle Company Amazon, initially set up as a ‘one stop bookshop’ where any book currently published could be bought. Within a short period of time Amazon started expanding it range of merchandise it sold, becoming the world’s largest online retailer. The benefits Amazon had for the consumer, choice and value. If the item was available, Amazon would have it and cheaper than anyone else. It wasn’t long before…

Keyword use in H1 headline texts

Overview The <h1> html tag is another original HTML element which has a great impact on search engine optimisation. The specification suggests this tag should be used as a main heading for a page, but technically it can be used more than once. History of the <h1> tag The <h1> tag is one of the core HTML tags which have been within HTML pages since day one. The h1 tag is one of the six H (heading) tags and is designed to head paragraphs of text. The h1 tag is considered the most important and by default is rendered extra large to show its importance. The h1 tag is also considered to be a heading for the whole page and although technically it can be used more than once, can be seen as spam if used more than once by Google. Google places weight on any text in a heading…

© 2011 Websites by Mark. Do not reproduce any part of this website without permission.
Email : mark@websitesbymark.co.uk - Phone : 07716 447228 / 01993 820005
Postal Address : 7 Woodrush Gardens, Carterton, Oxfordshire. OX18 1JE