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

the <h2> html tag
the <h2> html tag

The <h2> 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 <h2> tag itself is considered to be the main repeating heading for a webpage. By default it is displayed much larger than the body text but smaller than the main <h1> header. As with all h tags it is considered important for SEO.When text is put between the opening and closing <h2> tag it is displayed as a large heading. Unlike <h1> a <h2> tag can be used multiple times on a webpage as its job is to be the heading for a web pages main sub topics.

Basic Usage

<h2>Large header text</h2>
Any text between the opening and closing tag will be displayed as a large heading.

Advance Usage

It is possible to style and add functionality to the <h2> tag, this is done by adding an attribute to after the h2 in the opening <h2> tag
Attributes allowed for the <h2>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<h2 id=”header”>Large header text</h2>
With all attributes there is a space after the initial h2 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 <h2> tag the class attribute is nearly always used over the id attribute although in practice it makes no difference.
The attribute style allows you to include css style information for a single <h2> 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

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

Final Thoughts

Touching on just the surface of the <h2> 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.

The <h2> 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 <h2> tag itself is considered to be the main repeating heading for a webpage. By default it is displayed much larger than the body text but smaller than the main <h1> header. As with all h tags it is considered important for SEO.When text is put between the opening and closing <h2> tag it is displayed as a large heading. Unlike <h1> a <h2> tag can be used multiple times on a webpage as its job is to be the heading for a web pages main sub topics. Basic Usage <h2>Large header text</h2> Any text between the opening and closing tag will be displayed as a large heading. Advance Usage It is possible to style and add functionality to the <h2> tag, this is done…

Keyword use in page URL

Overview Keyword use in page URL is a technique much in the same vein as Keyword use in domain name. There is currently no evidence that Google is penalising sites which place keywords in the URL of the webpage, but this should be reviewed over time with regards to how important this ranking factor will be going forward. The importance of keywords in the domain name The below is an extract from the article which details the history if keyword in Domain name. Much of the below can apply to keyword use in URL but as with domain name should be reviewed in light of the recent Google EMD update. Originally it took a lot of money, time and effort to create a website. During this period people who had invested in a domain name which matched what they did was seen to have benefits and reinforce the likely content…

Apple iPad, Killer content or content Killer?

When Apple announced the iPad on the 27th January 2010, many things were expected. Like all rumour based predictions, some came true and some not. But a low powered tablet based computer without a keyboard, webcam or even Flash, is this really the future or has Steve made another Newtonian error? We call it the iPad Positioning the iPad as a device somewhere between an iPod and Laptop, Steve Jobs is once again trying to define a new genre of interaction between user and technology. As with a lot of Apple release kit, Steve has embraced the idea that Eye Candy engages users and well designed gadgets actually overturn conventional thinking and build brand confidence. What is odd about this latest offering from Apple is technology that was expected but is missing. After all this should be a killer way of interacting on social networks like Facebook, but with no…

Taking over the Internet one site at a time

For many years the traditional way of making sure your website was seen all over the world was to make sure your site ranked well on Google. By use of Back links, Page Rank and SEO, this set of techniques has become a black art known to a few gurus. With the introduction of Google Caffeine update is this about to change? How it started In 1998, the year Google was founded no-one could have predicted the growth of the internet and the importance of companies like Google to all our lives. Within a short period of time Google had indexed vast quantities of information and companies began to see the value of being included in the Google search results. With so many websites listed, it became vital if you wanted to have visitors, you had to be listed on Google front page. From this moment the term SEO or…

Are social networks really social?

With websites like Facebook and Twitter constantly attracting new users on a day by day basis, there is no doubt how popular the social networks are. But in a world of increase reports of medical conditions like depression, do social networks indicate underlying issues with the world today? BC – before computers. There is little argument that computers have transformed most people’s daily lives. If you do not use a computer yourself, your life is certainly affected by them, either through technologies like mobile phones, or even the switch to digital TV and radio. But there are other factors at play, of which computers usually get the label. Up until recent history the world was a very big place, in fact a person’s world would represent a small part of the world as a whole. Go back one hundred years and people did not really travel, they worked within walking…

© 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