Code learnt from: http://www.w3schools.com/html/
HTML: markup language for describing web documents
- Hyper Text Markup Language
- A markup language is a set of markup tags
- HTML documents are described by HTML tags
- Each HTML tag describes different document content
<!DOCTYPE html> {defines the document type to be HTML}
<html> {describes a HTML document}
<head> {provides info about the document}
<title> Page Title </title> {provides title for doc}
</head>
<body>
<h1> My First Heading </h1> {describes heading}
<p> My First paragraph. </p> {describes a paragraph}
</body>
</html>
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname> content </tagname>
< > opening tag
</ > closing tag
Web Browsers
The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them. The browser does not display to HTML tags, but uses them to determine how to display the documents.
Only the <body> area is displayed by the browser.
The <!DOCTYPE> Declaration
- Helps the browser to display the web page correctly
- There are different document types on the web
- To display a document correctly, the browser must know both the type and the version
- The doctype is not case sensitive
Common Declarations
Version: Year:
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML 5 2014
Write HTML using Notepad or Textedit
HTML can be edited by using a professional HTML editor like:
- Adobe Dreamweaver
- Microscoft Expression Web
- CoffeeCup HTML Editor
for learning HTML, use Notepad (PC) or TextEdit (Mac)
Get Started
- Open Notepad
- Write some HTML
<!DOCTYPE HTML>
<html>
<body>
<h1> My First Heading </h1>
<p> My first paragraph. </p>
</body>
</html>
3.Save the HTML page (.htm)
UTF-8 is the preferred encoding for the HTML files.
ANSI encoding covers US and Western European characters only.
You can use either .htm or .html as file extension. There is no difference, its up to you.
4. View HTML page in your browser.
To open a file in a browser, double click on the file, or right click and choose open with.
HTML Headings
HTML headings are defined with the <h1> to <h6> tags:
eg./ <h1> This is a heading </h1>
<h2> This is a heading </h2>
etc.
HTML Paragraphs
HTML paragraphs are defined with the <p> tag
Eg./
<p> This is a paragraph. </p>
<p> This is another paragraph. </p>
HTML Links
HTML links are defined with the <a> tag
Eg./
<a href= 'link' > This is a link </a>
The link address is specified in the href attribute.
Attributes are used to provide additional info about HTML elements.
HTML Images
HTML images are defined with the <img> tag.
The source file (src)
alternative text (alt)
and size (width and height)
are provided as attributes:
Eg./ <img src= "jpeg" alt= "text" width= "104" height= "142" >
The link address is specified in the href attribute.
Attributes are used to provide additional info about HTML elements.
HTML Images
HTML images are defined with the <img> tag.
The source file (src)
alternative text (alt)
and size (width and height)
are provided as attributes:
Eg./ <img src= "jpeg" alt= "text" width= "104" height= "142" >
No comments:
Post a Comment