HTML Notes PDF
HTML Notes PDF
What is HTML?
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets like
<html>
HTML tags normally come in pairs like <p> and </p>
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, with a slash before the tag name
Start and end tags are also called opening tags and closing tags
<tagname>content</tagname>
HTML Elements
In HTML, most elements are written with a start tag (e.g. <p>) and an end tag (e.g.
</p>), with the content in between:
<p>This is a paragraph.</p>
Creating HTML Document:
Creating an HTML document is easy. To begin coding HTML you need only two
things: a simple-text editor and a web browser. Notepad is the most basic of simple-
text editors and you will probably code a fair amount of HTML with it.
Web Browsers
The purpose of a web browser (such as Google Chrome, Internet Explorer, Firefox,
Safari) is to read HTML documents and display them as web pages.The browser does
not display the HTML tags, but uses the tags to determine how the content of the
HTML page is to be presented /displayed to the user:
HTML Versions
Since the early days of the web, there have been many versions of HTML:
Version Year
HTML 1991 HTML 3.2 1997 HTML5 2012
HTML+ 1993 HTML 4.01 1999
HTML 2.0 1995 XHTML 2000
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration helps the browser to display a web page correctly.
There are many different documents on the web, and a browser can only display an
HTML page 100% correctly if it knows the HTML version and type used.
Common Declarations
HTML5
<!DOCTYPE html>
HTML 4.01
HTML Headings
Example
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<HTML>
<HEAD>
<TITLE>JSPIDERS</TITLE>
<BASE>
<META>
</HEAD>
<BODY>
Text, Hyperlinks, Graphics, Animations, etc.
</BODY>
</HTML>
<HEAD>source code document header</HEAD>: identifies the start and end of the
header section of an HTML source code document.
<TITLE>source code document title</TITLE>: denotes the name displayed in the title
bar of the web browser
<BODY>source code document body</BODY>: identifies the start and end of the
body section of an HTML source code document.
Structuring Tags
<!-- comment --> (“comment” tag): allows the author to type a comment which helps
clarify something within an HTML source code document. This comment will not
appear in the marked up web document on the browser.
<BR> (“break” tag): forces a line break at that point, causing the text after the break to
be displaced down one line.
<HR> (“horizontal rule” tag): creates an engraved, shaded horizontal line at that
location.
The <HR> tag may contain within it further parameters as part of the command:
The <BODY> tag may contain within it further parameters as part of the command, each
designating the particular colors of various elements of a web document
TEXT="COLOR"|"#COLOR CODE": indicates the color of the text of a web document (the
default text color is black).
ALIGNMENT
"LEFT" (the default) aligns the heading with the left margin of the page.
"CENTER" centers the heading horizontally on the page.
"RIGHT" aligns the heading with the right margin of the page.
Note: Some browsers do not recognize the ALIGN parameter for headings.
inserts a single, non-breaking space where there otherwise would not be a space.
ALIGN="LEFT"|"CENTER"|"RIGHT"|"JUSTIFY":
wish to create subscripts and superscripts in the text. To do this, “subscript” and “superscript”
tags may be used:
(H<SUB>2</SUB>SO<SUB>4</SUB>)<SUP>§</SUP>
(H2SO4)
<PRE>text</PRE>: pre formats text, preserving the spacing between the words and characters
as typed in the source code.
Visit us:www.jspiders.com www.youtube.com/jspiders www.facebook.com/JspidersInstitute Page 5
Jspiders Rajajinagar Basic HTML-5 Notes
Style Tags
Most important method for transforming the text in an HTML source code document is by the
use of “font” tags:
<FONT>text</FONT>: changes the face (type), size, and/or color of ordinary text.
A <FONT> tag may contain within it any or all of the 3 parameters used to transform text:
FACE="TYPE": sets or changes the face (type) of font script. The default font type for most
browsers is “Times New Roman.”
A few font types are Arial, Brush Script, Century Comic Sans MS, Impact, Gothic, Lucida
Handwriting, Lydian, Verdana.
.SIZE="1"|"2"
COLOR="COLOR"|"#COLOR CODE"
Another common way to add emphasis to text, or to change its size, is by using “italic” tags,
“emphasis” tags, “bold” tags, “strong emphasis” tags, “underline” tags, “strike-through” tags,
“big” tags, and “small” tags:
<EM>text</EM>: emphasizes text by causing it to be italicized (like <I> & </I> above).
<TT>text</TT>: causes text to appear as though it had been typed on a standard typewriter,
MARQUEE
An interesting effect can be obtained by making print move on a page, using “marquee” tags:
<MARQUEE>text</MARQUEE>: creates an area in which moving text will advance across all
or a portion of a page, just as it does on some marquee signs.
A <MARQUEE> tag may contain within it other parameters as part of the command:
LOOP="N"|"INFINITE": specifies how many times “N” the text in a marquee will perform a
BEHAVIOR function. “N” must be a positive whole number. The loop default is "INFINITE";
ALIGN="TOP"|"MIDDLE"|"BOTTOM"
HTML Blocks
Most HTML elements are defined as block level elements or as inline elements.
Block level elements normally start (and end) with a new line when displayed in a browser.
When used together with CSS, the <div> element can be used to set style attributes to large
blocks of content.
Another common use of the <div> element, is for document layout. It replaces the "old way" of
defining layout using tables. Using <table> elements for layout is not the correct use of
<table>. The purpose of the <table> element is to display tabular data.
When used together with CSS, the <span> element can be used to set style attributes to parts of the text.
List Tags
The most common HTML lists are ordered and unordered lists:
List Tags
<LI> <OL> & </OL> VALUE (of <LI>)
<UL> & </UL>
TYPE <DL> & </DL>
TYPE <DL COMPACT> & </DL>
"I"
"DISC" "A" <DT>
"SQUARE" "1" <DD>
"CIRCLE" "a"
"i" <DIR> & </DIR>
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items are marked with bullets (typically small black circles).
The <dl> tag is used in conjunction with <dt> (defines terms/names) and <dd>
(describes each term/name)
HTML Tables
A table is divided into rows with the <tr> tag. (tr stands for table row)
A row is divided into data cells with the <td> tag. (td stands for table data)
A row can also be divided into headings with the <th> tag. (th stands for table
heading)
The <td> elements can contain all sorts of HTML elements like text, images, lists,
other tables, etc.
Tables
<TABLE> & </TABLE> BGCOLOR BGCOLOR
ALIGN ALIGN
BORDER VALIGN VALIGN
BORDERCOLOR WIDTH
BGCOLOR HEIGHT <TD> & </TD>
ALIGN COLSPAN
WIDTH ROWSPAN BGCOLOR
HEIGHT
ALIGN
CELLSPACING
CELLPADDING VALIGN
WIDTH
HEIGHT
COLSPAN
<TR> & </TR>
ROWSPAN
<TH> & </TH>
BORDER="B": creates a border (rim), of width “B” in pixels, around the edge of a
table.
WIDTH="W": defines the horizontal width “W” of an entire table on the page.
CELLSPACING="S": causes the non-colored portion of the border around a table and
between adjacent cells of the table to be “S” pixels in width.
COLSPAN="C": specifies how many columns “C” of a table a heading cell will span.
ROWSPAN="R": specifies how many rows “R” of a table a heading cell will span.
Graphic Images
<IMG> "TEXTTOP" WIDTH
"MIDDLE" HEIGHT
SRC "ABSMIDDLE" BORDER
ALIGN "BASELINE" HSPACE
"BOTTOM" VSPACE
"LEFT" "ABSBOTTOM"
"RIGHT"
"TOP"
Hyperlinks
<A HREF> & </A>
TARGET
<A NAME> & </A>
<A HREF> <IMG SRC> </A>
BEHAVIOR="SCROLL"|"SLIDE"|"ALTERNATE": specifies
how marquee text will behave as it moves horizontally on a
browser screen.
Forms
<FORM> & </FORM> CHECKED
METHOD Pop-up Box
ACTION
<SELECT> & </SELECT>
<INPUT>
<OPTION SELECTED>
Text Box (<INPUT>)
<OPTION>
TYPE Text Area Box
NAME
<TEXTAREA> & </TEXTAREA>
SIZE
MAXLENGTH NAME
VALUE ROWS
COLS
Password Box (<INPUT>)
Submit Button (<INPUT>)
Radio Buttons (<INPUT>)
Reset Button (<INPUT>)
Checkboxes (<INPUT>)
showing, the remainder of the <OPTION> items will “pop up” into
view after clicking on the first item.
<OPTION SELECTED>: denotes which item will be shown
initially in the pop-up box when only one selection is permitted, or
which items within the box will be highlighted when multiple
selections are permitted.
<OPTION>: denotes each item which will appear when the pop-
up box is activated.
<TEXTAREA>(optional text)</TEXTAREA>: creates a
box in which information may be typed and then emailed to the
person requesting the information
ROWS="R": defines the number of rows (lines) “R” of text that are
visible in the text box.
example or hint text that is shown in a form field when the field is
unfocused and has no input from the user.
Frames
ROWS "H" COLS"W" "_PARENT"
"_TOP" FRAMEBORDER
<FRAME>
<area> Specifies an area inside an image map <dt> Specifies a definition term
<base> Specifies a base URL for all the links <embed> Deprecated. Embeds an application in
in a page a document
<bdo> Specifies the direction of text display <font> Deprecated. Specifies text font, size,
and color
<bgsound> Specifies the background music
<form> Specifies a form
<big> Specifies big text
<frame> Specifies a sub window (a frame)
<blink> Specifies a text which blinks
<frameset> Specifies a set of frames
<blockquote> Specifies a long quotation
<h1> to <h6> Specifies header 1 to header 6
<body> Specifies the body element
<head> Specifies information about the
<br> Inserts a single line break document
<button> Specifies a push button <hr> Specifies a horizontal rule
<caption> Specifies a table caption <html> Specifies an html document
<center> Deprecated. Specifies centered text <i> Specifies italic text
<cite> Specifies a citation <iframe> Specifies an inline sub window
(frame)
<code> Specifies computer code text
<ilayer> Specifies an inline layer
<col> Specifies attributes for table columns
<img> Specifies an image
<colgroup> Specifies groups of table columns
<input> Specifies an input field