You are on page 1of 2

HTML:

<!-- (start of comment)


--> (end of comment)
Note: it is the same syntax for one line or multiple line comments

Start your page with html5 declaration


<!doctype html> (don't mention html5)

To write a tag name


Start with right angle bracket < immediately type left angle bracket > so it looks
like <>
add your tag name between the angle brackets <html>
Immediately add the closing tag - copy the starting <html>
bring the cursor back before the tagname of the tag i.e. after the left angle
bracket
add a / so the line looks like this <html></html>
Bring the cursor back in between the opening and closing tag > <
Press enter twice so the code looks like below
<html>

</html>
Bring the cursor up to the empty line and add a tab space.
<html>
____ (underscore indicate empty space. Dont type underscore)
</html>

Repeat line number 10 to 23 for any tags between the parent tag.
Any opening and closing tag pair is called an element.
Always follow the <html><head></head><body></body></html> structure
The outer tag of an element is called its parent.
An element inside the tag is called child.
Elements which are child of the same parent tag are called siblings.
The text mentioned between the opening and closing tag is called TextElement
<h1>THIS IS TEXT ELEMENT</h1>

Some tags are self-closing, they end with />


<input type="text" name="fname" />

The name-value pair on a tag is called tag attribute


<div id="div1" class="mydiv"> (here id and class are called attributes)
Always add attibute on the start tag.
To add an attribute type the name of the attribute before the > (right angle
bracket)
follow with =(equals)symbol and type two single quotes or double qoutes(id="")
if you do not provide second quote, then you may forget to add it and the tag name
becomes invalid.
Bring the cursor back between the two quotes and start typing the value.
Give unique values to id attributes. Do not repeat the id value.
add multiple css class names with a space between the names.
class="class1 class2"
Semantic tags means tags which are created for some purpose for both the browser
and the developer
Semantic tags also help speech assistance tools.
The advantage of HTML5 is in using semantic markup.
For eg. <header> for page banner, <nav> for navigation of internal pages.
<section> for page content, <article> for textual content.
<aside> for secondary content related to section or article
<footer> for page bottom containing sitemap links, email link, copyright
information etc.
Use <table> tag for displaying records in the rows and columns format.
<table>
<tr>
<td></td>
</tr>
</table>
<table> tag means start of a data table.
<tr> means start of a row
<td> means start of a cell.

Avoid applying styles on the tag name. <table style="background-color:green"> is


not a good practice.
Avoid putting script tags inside the <body> tag.
Use suggestions from the code editor where ever possible, to avoid spelling
mistakes.

You might also like