HTML Introduction
HTML or HyperText Markup Language is the standard markup language used to create web pages.
HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like
<html>
). HTML tags most commonly come in pairs like <h1>
and </h1>
, although some tags represent empty elements and so are unpaired, for example <img>
. The first tag in a pair is the start tag, and the second tag is the end tag (they are also called opening tags and closing tags).A web browser can read HTML files and compose them into visible or audible web pages. The browser does not display the HTML tags, but uses them to interpret the content of the page. HTML describes the structure of a website semantically along with cues for presentation, making it a markup language rather than a programming language
HTML is a language for describing web pages.
- HTML stands for Hyper Text Markup Language
- HTML is a markup language
- A markup language is a set of markup tags
- The tags describe document content
- HTML documents contain HTML tags and plain text
- HTML documents are also called web pages
HTML Tags
HTML markup tags are usually called HTML tags.- HTML tags are keywords (tag names) surrounded by angle brackets like <html>
- HTML tags normally come in pairs like <p> and </p>
- The first tag in a pair is the start tag, the second tag is the end tag
- The end tag is written like the start tag, with a slash before the tag name
- Start and end tags are also called opening tags and closing tags
<tagname>content</tagname>
.HTML Versions
Since the early days of the web, there have been many versions of HTML:Version | Year |
---|---|
HTML | 1991 |
HTML+ | 1993 |
HTML 2.0 | 1995 |
HTML 3.2 | 1997 |
HTML 4.01 | 1999 |
XHTML | 2000 |
HTML5 | 2012 |
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration helps the browser to display a web page correctly.There are many different documents on the web, and a browser can only display an HTML page 100% correctly if it knows the HTML version and type used.
HTML Page Structure
Below is a visualization of an HTML page structure:
<html>
<body>
</html>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
What is HTML5?
HTML5 is the fifth revision and newest version of the HTML standard. It offers new features that provide not only rich media support, but also enhance support for creating web applications that can interact with the user, his/her local data, and servers, more easily and effectively than was possible previously. Because HTML5 is still being developed, changes to the specifications are inevitable. Therefore, not all of its features are supported by all browsers yet. However, Gecko, and by extension, Firefox, has very good initial support for HTML5, and work continues toward supporting more of its features. Gecko began supporting some HTML5 features in version 1.8.1. You can find a list of all of the HTML5 features that Gecko currently supports on the main HTML5 page. For detailed information about multiple browsers' support of HTML5 features, refer to the CanIUse website.Declaring that the document contains HTML5 mark-up with the HTML5 doctype
The doctype for HTML5 is very simple. To indicate that your HTML content uses HTML5, simply use:<!DOCTYPE html>
Doing so will cause even browsers that don't presently support HTML5
to enter into standards mode, which means that they'll interpret the
long-established parts of HTML in an HTML5-compliant way while ignoring
the new features of HTML5 they don't support.This is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded.
Declaring the character set with the <meta charset>
The first thing done on a page is usually indicating the character
set that is used. In previous versions of HTML, it was done using a very
complex <meta>
element. Now, it is very simple:
<meta charset="UTF-8">
Place this right after your
<head>
,
as some browsers restart the parsing of an HTML document if the
declared charset is different from what they had anticipated. Also, if
you are not currently using UTF-8, it's recommended that you switch to
it in your Web pages, as it simplifies character handling in documents
using different scripts.Note that HTML5 restricts the valid charset to that compatible with ASCII and using at least 8 bits. This was done to tighten security and prevent some types of attacks.
Comments