HTML Tag Reference

0

Posted by Sanjeet Kumar Verma | Posted in

Basic Structure

<!DOCTYPE>
The DTD (Document Type Declaration), this tells your browser which version of HTML you're using. Make sure you use the right DTD, or your page may display incorrectly.
<html>...</html>
Standard opening and closing tags for any HTML page. Enclose everything else in these. Container tag.
<!-- ... -->
A comment — whatever you put here will be skipped over by the browser.
<head>...</head>
Starts the header part of your document. Everything between these is mainly used to help your browser and search engines classify your page. Using this is optional, but recommended. Container tag.
<title>...</title>
Whatever is between these tags will appear in the blue bar at the top of the screen.
<meta>
A group of tags that give page and creator information specifically to the search engines.
<base>
Changes the default link target or relative link URL, useful if the page is read on another server.
<link>
Allows you to associate stylesheets and a favorites icon to your page.

<body>...</body>

Everything visible on your page goes between these tags. Everything. Container tag.
<a>...</a>
Makes the enclosed text or image a hyperlink to another file.

Lists

<ol>...</ol>
Creates an ordered list, where each item is numbered in order. Container Tag.
<ul>...</ul>
Creates an unordered list, with each item bulleted. Container Tag.
<li>
Each list item begins with an li, and they are all placed in either an ol or ul.

<dl>...</dl>

Creates a definition list.

<dt>
Creates a definition term.
<dd>
Creates a definition, which appears below its parent term and indented from the left.

Multimedia

<img>
Places an image on your page
<embed>
Adds a multimedia element directly into your page, allowing your browser to play it with a plug-in.
<script>...</script>
Adds a script, usually a JavaScript into your page.
<noscript>...</noscript>
Enclose anything you want displayed by browsers that do not support scripts.

Tables

<table>...</table>
Places a table on your page. Container Tag.
<caption>...</caption>
contains the caption of the table, the title of sorts. It will appear across the top unless specified otherwise. This tag should not be contained in a tr or td.
<tr>...</tr>
starts a new table row. Cells go inside this. Attributes are the same as td's.
<td>...</td>
encloses a table cell. Content goes in these.
<th>...</th>
same as table cells, but with all contents bold and aligned to the centre.
<thead>...</thead>
Defines the header part of a large table. Wrap the tags around the rows/cells you wish to define as the header.
<tbody>...</tbody>
Defines the main body of a complex table.
<tfoot>...</tfoot>
Wrap this around the footer part of your table.
<colgroup>
Allows you to set attributes for the entire column. Each column has to be defined sequentially.

Frames

<frameset>...< /frameset>
Starts a new frame layout. When constructing a frame page, no body is used. Container Tag.
<frame>
Defines a single frame within a frameset.
<noframes>...< /noframes>
If a visitor has an old browser which doesn't support frames you can leave a message or some content between these tags.

<iframe>...</iframe>

Places an inline or 'floating' frame. This can be placed anywhere on a normal page, i.e. it doesn't need to be part of a frameset.

Forms

<form>...</form>
Begins a form area. Add in any form elements you want to use between these tags. Container Tag.
<input>
Allows you to add various user input fields, like text-boxes, checkboxes, radio buttons, submit and reset buttons, depending on how you set the type attribute.
<textarea>...</textarea>
Adds a multi-lined text area, suitable for input of a larger amount of information than the single-line text box. Any text added between the tags is placed in the area when the page loads.
<select>...</select>
Sets up an empty drop-down selection box. You can add choices with the <option>...</option> tag.
<fieldset>...</fieldset>
Allows you to group form elements together into logical arrangements.
<legend>...</legend>
You can title your fieldsets with this tag.
<label>...</label>
You can make the explanatory text next to a form element into part of the clickable area with this tag, which makes selecting elements much easier.

Text Formatting

<address>...</address>
Encloses the signature and address of the author, displayed in italics.
<b>...</b>
Makes the enclosed text into bold text.
<big>...</big>
Makes the enclosed text one size bigger.
<blockquote>...</blockquote>
Indents the text in from both sides.
<br>
Stops the current line and goes on to the next.
<center>...</center>
Aligns the surrounded objects (anything from text or images to forms etc.) to the center.
<cite>...</cite>
Includes a citation, and is usually rendered as italics.
<code>...</code>
If you are including either computer or HTML code into your documents wrap these around it. It is rendered in small text.
<dfn>...</dfn>
A definition. As usual with these things, rendered in italics.
<div>...</div>
Surround distinct sections of your page in divs, primarily to align them, but many other attributes are supported and divs can be used to set up layers too.
<em>...</em>
Emphasises the surrounded text, changing it to italics.
<font>...</font>
Sets the font properties for the selected text.
<hx>...</hx>
Sets the text as a heading, with values of h1 (the biggest) to h6 (the smallest).
<hr>
Inserts a grey horizontal line across the page.
<i>...</i>
The default tag for italics.
<kbd>...</kbd>
Implies that the text should be entered on the keyboard. It is rendered mono-spaced and small.
<nobr>...</nobr>
Tells the enclosed text not to wrap at the edge of the screen, but continue on as long as it needs.
<wbr>
If you need a line break in a block of text you have set in nobr, add this.

<p>...</p>

Makes the enclosed text a paragraph, with lines skipped at the top and bottom.

<pre>...</pre>

Displays text in fixed-width font and retains the formatting of the original text (i.e. spaces and line-breaks).

<q>...</q>

Used to mark up short, inline quotations. Some browsers will add quotation marks around the text.

<s>...</s> (or <strike>...</strike>)

Displays the text with a strike-through.

<samp>...</samp>

Indicates sample output from a form or program. Text is rendered in small font.

<small>...</small>

Makes the enclosed text one size smaller.

<strong>...</strong>

Creates emphasis for the selected text, rendered in bold.

<sub>...</sub>

Renders the text in subscript, which is words under the normal text. For example: this

<sup>...</sup>

The sister tag to <sub> above, this renders text in superscript. Like this

<tt>...</tt>

Renders text in fixed-width, mono-spaced font; like an old typewriter.

<u>...</u>

Displays the surrounded text underlined.

What is HTML ?

0

Posted by Sanjeet Kumar Verma | Posted in

What is HTML?

HTML is a computer language devised to allow website creation. These websites can then be viewed by anyone else connected to the Internet. It is relatively easy to learn, with the basics being accessible to most people in one sitting; and quite powerful in what it allows you to create. It is constantly undergoing revision and evolution to meet the demands and requirements of the growing Internet audience under the direction of the » W3C, the organisation charged with designing and maintaining the language.
The definition of HTML is HyperText Markup Language.
  • HyperText is the method by which you move around on the web — by clicking on special text called hyperlinks which bring you to the next page. The fact that it is hyper just means it is not linear — i.e. you can go to any place on the Internet whenever you want by clicking on links — there is no set order to do things in.
  • Markup is what HTML tags do to the text inside them. They mark it as a certain type of text (italicised text, for example).
  • HTML is a Language, as it has code-words and syntax like any other language.

How does it work?

HTML consists of a series of short codes typed into a text-file by the site author — these are the tags. The text is then saved as a html file, and viewed through a browser, like Internet Explorer or Netscape Navigator. This browser reads the file and translates the text into a visible form, hopefully rendering the page as the author had intended. Writing your own HTML entails using tags correctly to create your vision. You can use anything from a rudimentary text-editor to a powerful graphical editor to create HTML pages.

What are the tags up to?

The tags are what separate normal text from HTML code. You might know them as the words between the <angle-brackets>. They allow all the cool stuff like images and tables and stuff, just by telling your browser what to render on the page. Different tags will perform different functions. The tags themselves don’t appear when you view your page through a browser, but their effects do. The simplest tags do nothing more than apply formatting to some text, like this:
<b>These words will be bold</b>, and these will not.
In the example above, the <b> tags were wrapped around some text, and their effect will be that the contained text will be bolded when viewed through an ordinary web browser.
If you want to see a list of a load of tags to see what’s ahead of you, look at this tag reference. Learning the tags themselves is dealt with in the next section of this website, My First Site.

Is this going to take long?

Well, it depends on what you want from it. Knowing HTML will take only a few days of reading and learning the codes for what you want. You can have the basics down in an hour. Once you know the tags you can create HTML pages.
However, using HTML and designing good websites is a different story, which is why I try to do more than just teach you code here at HTML Source — I like to add in as much advice as possible too. Good website design is half skill and half talent, I reckon. Learning techniques and correct use of your tag knowledge will improve your work immensely, and a good understanding of general design and the audience you’re trying to reach will improve your website’s chances of success. Luckily, these things can be researched and understood, as long as you’re willing to work at it so you can output better websites.
The range of skills you will learn as a result of running your own website is impressive. You’ll learn about aspects of graphic design, typography and computer programming. Your efficiency with computers in general increases.You’ll also learn about promotion and your writing will probably improve too, as you adapt to write for certain audiences.

Do I have to be online all the time?

Not at all. You can code your entire website offline, storing it all on your own computer, and then just transfer all the files onto the web. Then whenever you have new content, you just add that to the existing online version of your site. It’s really quite simple.

Is there anything HTML can’t do?

Of course, but since making websites became more popular and needs increased many other supporting languages have been created to allow new stuff to happen, plus HTML is modified every few years to make way for improvements.
Cascading Stylesheets are used to control how your pages are presented, and make pages more accessible. Basic special effects and interaction is provided by JavaScript, which adds a lot of power to basic HTML. Most of this advanced stuff is for later down the road, but when using all of these technologies together, you have a lot of power at your disposal.

Why not get a quick view of times gone by with The History of HTML? If you think you’re ready to start coding, head over to the My First Site section and begin creating!