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

the <div> html tag
the <div> html tag

The <div> html tag

Overview

In simple terms the <div> HTML tag stands for division. It is one of the most widely used tags in HTML today. With the use of CSS it allows virtually any design to be created. Prior to the <div> tag, layout was created using the <table> tag. Div based layouts are considered to be better than table based layouts due to a number of factors including accessibility and SEO. As mentioned CSS allows this tag to create virtually any layout, but due to differences between how internet browsers support CSS, a consistant result can be harder to acheive.When text is put between the opening and closing <div> tag it is displayed as a Division.

Basic Usage

<div>Some div text in here</div>
Any text between the opening and closing tag will be displayed as a Division.

Advance Usage

It is possible to style and add functionality to the <div> tag, this is done by adding an attribute to after the p in the opening <div> tag
Attributes allowed for the <div>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<div id=”header”>Some div text</div>
With all attributes there is a space after the initial p 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 <div> tag may use either the id or class as an atribute.
The attribute style allows you to include css style information for a single <div> 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

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

Final Thoughts

Touching on just the surface of the <div> 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 <em> html tag

Overview The <em> HTML tag is known as a phrase tag, it is mainly used to style text. By default it makes text italic to emphasize the look of the tagged text. It works equally as well in table based layouts as well as CSS based ones. As with all phrase based HTML tags it can be used in situations where consistancy between browsers is difficalt to acheive in other ways. When text is put between the opening and closing <em> tag it is displayed as a emphasize text. Basic Usage <em>Some emphasize text in here</em> Any text between the opening and closing tag will be displayed as a emphasize text. Advance Usage It is possible to style and add functionality to the <em> tag, this is done by adding an attribute to after the p in the opening <em> tag Attributes allowed for the <em>tag include :-class, dir, id,…

The <h6> html tag

In HTML h tags stand for heading and this is split into 6 different h tags (h1, h2, h3, h4, h5 and h6). By default it is displayed as bold and much smaller version of the body text. As with all h tags it is considered important for SEO.When text is put between the opening and closing <h6> tag it is displayed as a Small heading. Unlike <h1> a <h6> tag can be used multiple times on a webpage as its job is to be the heading for a web pages sub topics. The <h6> tag is not used often due to 5 other h tags being available. Basic Usage <h6>Smallest header text</h6> Any text between the opening and closing tag will be displayed as a very small heading. Advance Usage It is possible to style and add functionality to the <h6> tag, this is done by adding an attribute…

The Impact of the recent EMD update on search engine optimisation

EMD, or Exact Matched Domain, has always been an extremely important process for businesses as they first venture online. With the recent EMD update how should we be thinking as an industry about the way we manage accounts in the future? Put simply, an EMD is an exact keyword used within a domain for instance, if you were purchasing a website domain for an accountant in Bristol, you could use the domain bristolaccountants.co.uk. A brand domain on the other hand would use the name of the company instead. In the past, companies that were purchasing domain names for new websites would choose exact domains in relation to the keyword that they were specifically targeting, giving them an almost certain chance of appearing within the higher echelons of the Google search rankings. With the latest EMD updates things are changing and search engine optimisation professionals may have to tweak their approach.…

The <div> html tag

Overview In simple terms the <div> HTML tag stands for division. It is one of the most widely used tags in HTML today. With the use of CSS it allows virtually any design to be created. Prior to the <div> tag, layout was created using the <table> tag. Div based layouts are considered to be better than table based layouts due to a number of factors including accessibility and SEO. As mentioned CSS allows this tag to create virtually any layout, but due to differences between how internet browsers support CSS, a consistant result can be harder to acheive.When text is put between the opening and closing <div> tag it is displayed as a Division. Basic Usage <div>Some div text in here</div> Any text between the opening and closing tag will be displayed as a Division. Advance Usage It is possible to style and add functionality to the <div> tag,…

Un Social Network

In a world where every company and famous name is using social media to increase brand awareness, with the recent BA and Nestle online faux pas hitting the headlines, is it a case that social media is a two way street too far? When I was a lad. For years companies have used traditional media to manage it appearance to its customers. And by using traditional broadcast and media techniques, ad agencies have been very successful in offering real values to their clients. Both TV and magazine advertising has always been expert in presenting a ‘snapshot’ of the lifestyle a product offers and with only their voice to be heard for the 30 seconds between programmes. Companies have always loved the idea of a warm captive audience receptive to the advertising massage being broadcast. With the advent of the internet and the popularity of certain websites it was not long…

© 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