Tuesday, May 22, 2012

week 10 - HTML

today's topic is HTML which stands for Hyper Text Markup Language

HTML is not a programming language. just like the name suggests, it is used to markup language. a markup language is a set of markup tags. the tags are designed to describe page content.

example :

<p>This is a paragraph.</p>


 The correct structure for an HTML document starts with <HTML><HEAD>(enter here what document is about)<BODY> and ends with </BODY></HTML>. All the information you'd like to include in your Web page fits in between the <BODY> and </BODY> tags.



  • An HTML element starts with a start tag / opening tag
  • An HTML element ends with an end tag / closing tag
  • The element content is everything between the start and the end tag
  • Some HTML elements have empty content
  • Empty elements are closed in the start tag
  • Most HTML elements can have attributes

examples :

<!DOCTYPE html>
<html>

<body>
<p>This is my first paragraph.</p>
</body>

</html>


The body element

<body>
<p>This is my first paragraph.</p>
</body>


The <body> element defines the body of the HTML document. The element has a start tag <body> and an end tag </body>. The element content is another HTML element (a p element).

The HTML element

<html>

<body>
<p>This is my first paragraph.</p>
</body>

</html>


The <html> element defines the whole HTML document. The element has a start tag <html> and an end tag </html>. The element content is another HTML element (the body element). 


Empty elements



HTML elements with no content are called empty elements.
<br> is an empty element without a closing tag (the <br> tag defines a line break).
Tip: In XHTML, all elements must be closed. Adding a slash inside the start tag, like <br />, is the proper way of closing empty elements in XHTML (and XML).


Elements can have attributes

attributes is the argument inside a HTML tags.

<A HREF="http://www.somewhere.ca/file.html"> marked text </a>.


the element A is the markup for the beginning of the elements. one of the attributes is HREF, a place where the hypertext link in the webpages. to specify the this in the tag, user should write like above. where the attribute HREF is assigned the indicated value. Note that the A element is not empty, and that it is closed by the tag </a>. Note also that end tags never take attributes -- the attributes to an element are always placed in the start tag.





No comments:

Post a Comment