Many people on the internet aren’t familiar with how to make a decent website on the internet. In an effort to remedy that, this episode kicks off the first of a five part series explaining the different aspects of building a good looking, database driven website from scratch.
In Part 1 of this series, we will take a look at HTML basics.
Here’s a list of the other tutorials in the series:
HTML stands for Hyper Text Markup Language and provides the backbone structure for webpages. Not to be confused with a programming language, HTML is a markup language that was designed to link documents and media together in an interactive way.
HTML is standardized through W3C and the latest version is HTML 4.01 (see http://www.w3.org/TR/html401/).
HTML is evolving constantly and presently there are 2 important variations eg XHTML and HTML5.
XHTML (eXtensibleHTML) is a derivation of HTML and XML. HTML5 is the fifth revision of the HTML standard. (see http://en.wikipedia.org/wiki/HTML5.)
HTML/XHTML/HTML5 have different Doctype Definitions (DTD’s) to be identified by browsers. For standards compliant HTML a web page needs a valid DTD (at the top of the html page).
HTML 4.01 strict DTD :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
For information on valid DTD’s, see http://www.w3.org/QA/2002/04/valid-dtd-list.html.
There is a large selection of software available on the market (free and paid) directed towards website creation. A majority of website creation software is called What You See Is What You Get or WYSIWYG. A good example of commercial software is Adobe’s Dreamweaver, while a good example of open source software is Mozilla’s Kompozer software. Despite the availability of web design software, it is not required to create a website. A website can be created using a basic text editor and a web browser for previewing.
HTML utilizes an element tagging structure. This means that every element of the code is tagged so that the web browser knows how to translate it. With a few exceptions, each tag generally comes in pairs: and opening tag and a closing tag. In between each tag is the content that is being tagged. Certain tags can also contain attributes, which enhances the properties of the tagged content.
For a list of commonly used tags, visit the tags page. An HTML tag is used by browsers to help classify and organize different elements within a web page. Tags are characterized by being surrounded by an opening and closing angle bracket (example: <tag>). An opening tag (example: <tag> signifies the begenning of an element’s section and a closing tag (example: </tag> is signifies the end of an element’s section. Here’s an example of a how a paragraph element tag would be used:
<p>Welcome to my webpage</p>
For some tags, the element does not need to surround or encompass any content. In those cases, it is not necessary to have both an opening and closing tag. Instead, a shorthand is available to close out the tag. It consists only of a forward slash and a closing angle bracket. An example of it’s usage can be seen in image element tag:
- <li>List Item</li>
Tags that don’t have closings
Tags can be nested
HTML text formatting generally takes place in the body of the HTML code. It includes text structure, such as paragraphs, lists, font color, bold, italicizing, and underlining. The table lists a few of the commonly used text formatting tags, but you can find a more extensive list here
|Formatting Tag||Formatting Name||Description||Example||Output|
|<p>||Paragraph||Designates the beginning and ending of a paragraph||<p>This is my paragraph</p>||This is my paragraph|
|<b>||Bold||Makes the tagged font bold.||<b>This is my paragraph</b>||This is my paragraph|
|<i>||Italics||Italicizes the tagged font.||<i>This is my paragraph</i>||This is my paragraph|
|<u>||Underline||Underlines the tagged font.||<u>This is my paragraph</u>||This is my paragraph|
|<ul>||Unorganized List||Creates a bulleted list. MUST be coupled with the <li> tag||<ul>
|<ol>||Organized List||Creates a numbered list. MUST be coupled with the <li> tag||<ol>
|<li>||Organized List||Creates a numbered list. MUST be coupled with either the <ul> or <ol> tags||<ol>
For a list of commonly used attributes, visit the attributes page. HTML attributes are found inside of tags and help to enhance the properties of the tagged element. Attributes follow the format of “attribute name” followed by a “=” and then the attribute value surrounded by quotes. Here’s an example
For table attributes (bgcolor, images, rowspan, colspan), visit the table page. There are many ways to organize the layout of a webpage using different scripting techniques, but the best way to do it using solely HTML is through the use of tables. While they are very useful, tables can be exceedingly difficult to use depending on how complicated your layout is. A tables structure has to follow certain tagging guidelines in order for it to work properly. These guidelines are as follows:
- Each table begins and ends with the <table></table> tags.
- Before the table will work, you must have at least one row and one column.
- Nested between the table tags are the row tags <tr></tr>.
- You must have at least one row in each table in order for it to function properly.
- Each row must have at least one column nested within it.
- Nested between the row tags are data cell tags <td></td>.
- You must have at least one data cell in each row.
- You must have the same ammount of cells in each row (unless using colspan or rowspan attributes)
- Although these are commonly know as “column” tags, they represent cells. A cell can exist without a column, but a column cannot exist without a cell.
Here is an example of a two cell, two row table:
- <td>row 1, col 1</td>
- <td>row 1, col 2</td>
- <td>row 2, col 1</td>
- <td>row 2, col 2</td>