1. What is HTML?
HTML, or Hypertext Markup Language, is a markup language that's primarily used for Web documents. Any document that's written in a markup language is interspersed with tags that indicate the meanings of certain passages. Since version 2.0, HTML has been an application of a more generic markup language: SGML (Standard Generalized Markup Language).
HTML defines a number of element types. An element type assigns some semantic meaning to its content. For example, the em element type gives its content emphasis over the surrounding text. An element is a concrete instance of an element type. An element usually consists of a start tag (
), some content, and an end tag ().
This HTML stuff is really,
really nifty!
HTML allows some end tags (and even a few start tags) to be omitted. Don't confuse tags with elements; a body element will be present even if the and tags are omitted. Certain element types must not have an end tag. One example is br, which signifies a line break.
Baa baa black sheep, have you any wool?
Yes sir, yes sir, three bags full
A start tag can contain attributes, comprising an attribute name, an equal sign (=), and an attribute value. For example, we can use the lang attribute to specify the language of an element's content.
Jean-Claude often exclaimed
bon sang despite the fact that no-one understood him.
Attribute values must be quoted in some instances, so it's good practice always to quote all attribute values. Some boolean attributes are allowed to be minimised in HTML, which means the name and the equal sign are omitted (e.g. selected instead of selected=«selected»). Some attributes are required for some element types, e.g., the alt attribute in an img element.
<img src="/images/sitepoint.gif" alt="SitePoint">
Beginners often use phrases like «alt tag», but this is incorrect nomenclature; alt is an attribute, not a tag. Tags are surrounded by <...>.
(
Read more
)