HTML g2
HTML g2
HTML g2
<html>...</html>
</body>
</html>
Tags
The text between <html> and </html>
describes the web page
The text between <body> and </body> is the
visible page content
The text between <h1> and </h1> is displayed
as a heading
The text between <p> and </p> is displayed as
a paragraph
Creating and Publishing a Web
PAGE
Create an HTML document
Place the document in the world-accessible
directory (often public HTML or WWW) on a
system running an HTTP server.
Access the webpage through
http://hostname/~username/filename
Eg. http://www.apl.jhu.edu/~lmb/test.htm
Validate the document
HTML DOCUMENT
TEMPLATE
MAIN HTML ELEMENTS
DOCTYPE
HTML
HEAD
- TITLE element required
-Optional elements
-BASE
-META
-BGSOUND
-SCRIPT,NOSCRIPT
-STLYE
BODY element
- HTML Attributes and attribute values
-BACKGROUND
-BGCOLOR
-TEXT
-LINK,VLINK,ALINK
Elements inside BODY element
bgcolor: This is the background color of the entire HTML
document, and may be specified either by the color name
directly or by the six-digit hex code.
alink: The color of the links.
vlink: The color of the visited links.
topmargin: The margin from the top of the browser window.
leftmargin: The margin from the left of the browser window.
BLOCK LEVEL ELEMENTS
HEADINGS
Types Of Headings:
<H1>….</H1>
<H2>….</H2>
<H3>….</H3>
<H4>….</H4>
<H5>….</H5>
<H6>….</H6>
Headings are from H1 to H6
Attributes are: LEFT(default), RIGHT,CENTER
P- The BASIC PARAGRAPH
Paragraphs are defined with the <p> tag.
<html>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
Formatting Tags
Font(face,size,color)
<font size=2 face="Helvetica" color=red>This
illustrates the attributes of the font tag.</font>
<center>
The <center> tag causes all the text within the tag to be
centered.
<center>This is centered text.</center>
<b>-Bold
<i>-Italic
<u>Underline
<html> This is a paragraph.
<body> This is a paragraph.
<p>This is a This is a paragraph.
paragraph.</p>
<p>This is a
paragraph.</p>
<p>This is a
paragraph.</p>
</body>
</html>
HTML LISTS
The most common HTML An unordered list:
lists are ordered and List item
unordered lists: List item
Ordered list
List item
Unordered list
An ordered list:
1.The first list item
2.The second list item
3.The third list item
HTML Unordered Lists
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).
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
OUTPUT:
Coffee
Milk
Attributes: type(disc,square,circle)
HTML Ordered Lists
An ordered list starts with the <ol> tag. Each list item starts
with the <li> tag.
The list items are marked with numbers.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
OUTPUT:
1.Coffee
2.Milk
HTML Definition Lists
A definition list is a list of items, with a description of each item.
The <dl> tag defines a definition list.
The <dl> tag is used in conjunction with <dt> (defines the item in the list) and
<dd> (describes the item in the list)
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
Coffee
- black hot drink
Milk
- white cold drink
TEXT LEVEL ELEMENTS
Physical character styles
B,I,TT,U,SUB,SUP,SMALL,BIG,STRIKE,S,BLINK,Fo
nt
Logical Character styles
EM,STRONG,CODE,SAMP,KBD,DFN,VAR,
CITE
Hypertext
A
HREF,NAME,TARGET
Image Tag
IMAGES
IMG
SRC,ALT,ALIGN,WIDTH,HEIGHT,HSPACE,VSPAC
E,BORDER,USEMAP,ISMAP
MISC. TEXT LEVEL ELEMENTS
BR- Explicit line break
PHYSICAL CHARACTER
STLYES EXAMPLE
OUTPUT
Logical styles
LOGICAL CHARACTER
EXample
OUTPUT
HYPERLINK
A hyperlink (or link) is a word, group of words, or image that you can click on to
jump to a new document or a new section within the current document.
When you move the cursor over a link in a Web page, the arrow will turn into a
little hand.
</body>
</html>
OUTPUT
Click on the sun or on one of
the planets to watch it closer:
Html -Tables
Tables are defined with the <table> tag.
A table is divided into rows (with the <tr> tag), and
each row is divided into data cells (with the <td> tag).
td stands for "table data," and holds the content of a
data cell.
A <td> tag can contain text, links, images, lists,
forms, other tables, etc.
Defining a table structure in
HTML
Creating a table in HTML is very simple if you keep in mind that
you have to create one row at a time and create one column at a
time for each row. Let's say we want to create the following
table :
Col 1 Col 2
To create the top table, use the following code :
<table width="190" border="1">
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
</table>
Table attributes
1. Controlling cell spacing
To add space among a table cells, use the
cellspacing property.
<table width="40" border="1" cellspacing="10">
<tr>
<td>10</td>
<td>10</td>
</tr>
<tr>
<td>10</td>
<td>10</td>
</tr>
</table>
2. Controlling cell padding
To add space around the content of a cell, use
cellpadding in the table tag.
<table width="40" border="1" cellpadding="5">
<tr>
<td>5</td>
<td>5</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
</tr>
</table>
3. Modifying table background
color
If you like to change the background color for
the entire table, just use the bgcolor property
in the <table> tag.
You can also change the color for the entire
row (by inserting bgcolor inside the <tr> tag)
or for an individual cell (by inserting bgcolor
inside the <td> tag).
4.Controlling table with the align
property
By default, the browser places a table on the left
margin just like the text is placed on the left.
The table's align property has three possible values:
left - places the table on the left margin. Again, this is the
default alignment so it is not necessary to specify this if
you want the table to be placed on the left margin)
Center - places the table in the center of the page