Elements and Tags

HTML Elements

HTML documents are defined by HTML elements. Html Elements consists of Start Tag, some Content, End Tag.

what is Tags

Tags are labels you use to mark up the begining and end of an element.

All tags have the same format: they begin with a less-than sign “<" and end with a greater-than sign ">“.

Syntax for Elements

Start Tag (opening tag)       Content      End Tag(closing tag)
             

Example:

<p>   This is samplecontent   </p>

Empty HTML Elements

HTML elements with no content are called empty elements.

<br> is an empty element without a closing tag (the
tag defines a line break).

<br/>is proper way of define empty element in xhtml

HTML has no case sensitive . so no problem when you type <P>instead of <p>. both tag are same meaning for html.

HTML Element have attributes it provides additional meaning for the html element.

Html Attributes:

* Attributes are always specified in the start tag

* Attributes come in name/value pairs like: name=”value”

* Attribute values should always be enclosed in quotes.

HTML Comments

Comments can be inserted into the HTML code to make it more readable and understandable. Comments are ignored by the browser and are not displayed.

Example :

<!– This is a comment –>

source :w3schools

Posted in Html