
Page 1 of 3 This article is intended as a re-introduction to HTML and CSS, and something I have used in the past to give to any new employees who may have had HTML experience, but exhibited some bad habits in actual coding. You may think HTML is simple and you may think you know all you need to know, but HTML is misused daily. Following are some basics to help correct some of the common problems.
HTML is the language of the web, and we use it in creating web pages and rich-format emails. HTML stands for HyperText Markup Language. A markup language is a language that uses tags to construct a document. Most HTML tags that are used are structural: they define the parts of a document. The main tag in a document is the <html> tag. Within the <html> tag are a <head> and a <body>. The <head> contains non-viewable information about the document, including the <title>, <style> information, and possible <meta> information. Also within the <html> tag is the <body> tag, which contains the viewable body of the document.
Tags within the body are semantic as well. For example, a <p> tag denotes a paragraph:
<p>This is a paragraph.</p>
A <h1> tag denotes the top-level heading:
<h1>This is the Main Heading</h1>
Other heading tags are <h2>, <h3>, down to <h6>. Each level of heading is less important and usually smaller, but not necessarily. The number represents the importance of the contents of the tag rather than the size of the contents. A simple document might only contain paragraphs. A more complex document contains paragraphs under headings. Even more complex documents might contain lists, tables, images, and forms. The tags are used to define and describe the text contained within them.
The following are the major tags that should be used:
HTML 4.01 is the current implementation of HTML, however XHTML can be used as well. XHTML is simply HTML that is more structurally correct. The advantage of XHTML is that automated processes, such as XML parsers and databases, can more easily understand it.
Most tags that envelope content have a start tag and a close tag, such as list tags:
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
Here, the unordered list tags (<ul>) envelope two list items (<li>). The actual list items contain textual content.
Some tags that exist without separate closing tags are known as open tags and should be closed nonetheless if creating an XHTML document:
<img src="index.cfm" alt="" width="32" height="32" />
Tags are written in plain text; all lowercase. HTML files are created as plain text files with an .htm or .html extension. Files such as .cfm, .php, .asp, and .jsp are plain text files that contain HTML tags as well as server-side code for ColdFusion, PHP, Active Server Pages, and Java Server Pages respectively.
There are many more tags, but these are the main ones that are used. A full list can be found at the W3 web site. All HTML files should be verified and validated at the W3 site using their validator.
Keywords
html,tags,tag,css,style,structure,xhtml