HTML IntroductionWhat is HTML?HTML is a markup language for describing web documents (web pages).
HTML ExampleA small HTML document:
<!DOCTYPE html>
<html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> Try it Yourself ? Example Explained
Using this description, a web browser can display a document with a heading and a paragraph. HTML TagsHTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
Web BrowsersThe purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them. The browser does not display the HTML tags, but uses them to determine how to display the document: HTML Page StructureBelow is a visualization of an HTML page structure: <html>
<head>
<title>Page title</title>
</head>
<body>
</html>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
The <!DOCTYPE> DeclarationThe <!DOCTYPE> declaration helps the browser to display a web page correctly. There are different document types on the web. To display a document correctly, the browser must know both type and version. The doctype declaration is not case sensitive. All cases are acceptable:
<!DOCTYPE html>
<!DOCTYPE HTML> <!doctype html> <!Doctype Html> Common DeclarationsHTML5
<!DOCTYPE html>
HTML 4.01
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www./TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd">
HTML VersionsSince the early days of the web, there have been many versions of HTML:
|
|