by Prof.Chiramel Baby B.Tech
The file containing html will have .htm or .html as extension. you can type this file in notepad or in any html editor like firstpage
Html contains tags. Their function is to describe or effect the presentation of the page element the tag controls.
Tags can be container tags (paired) or standalone tags (single).
Some of the tags are description tags, which describe the contents inside.
Some tags describe the contents and got a presentation syle.
Paired tags got a starting and ending For example the entire document is enclosed in the paired tag
<html>..........</html>
This tag tells the entire contents is html code
all tags are given inside this tag. All the tags given should be properly nested.
html tag contains two main section tags head and body
<html>
<head>
.....
</head>
<body>
.......
</body>
</html>
head and body sections can contain many tags. The contents of tags in the head section is not displyed on the web page. One tag which we use inside head tag is title. the title enclosed in head tag will appear in title bar of the browser window.
<html>
<head>
<title>my page title</title>
</head>
<body>
Here we can give all the contents to be displayed on the page
</body>
</html>
body can cantain all text that is to be displayed on the page
<body>
Once upon a time
there was a king
</body>
Once upon a time there was a king
To break the line we give <br> tag which is a standalone tag
<body>
Once upon a time<br>
there was a king
<p>
he was very rich
</p>
his kingdom was far and wide
</body>
Once upon a time
there was a king
he was very rich
his kingdom was far and wide
<body text="red" bgcolor="cyan">
Once upon a time<br>
there was a king
</body>
Once upon a time
there was a king
<body text="red" background="backg1.gif">
Once upon a time<br>
there was a king
</body>
Once upon a time
there was a king
| black | #000000 | silver | #cococo |
| gray | #808080 | white | #ffffff |
| maroon | #800000 | red | #ff0000 |
| purple | #800080 | fuchsia | #ff00ff |
| green | #008000 | lime | #00ff00 |
| olive | #808000 | yellow | #808000 |
| navy | #000080 | blue | #0000ff |
| Teal | #008080 | aqua | #00ffff |
<body background="boxes.gif">
if it one directory forward in images directory in your present directory give pathbackground="images/boxes.gif"
If the images directory is in a directory one step behind your present directory give the path asbackground="../images/boxes.gif"
<h1>this is heading h1<h1>
<h2>this is heading h2<h2>
etc upto h6<hr>
This will give a line like<hr align="right" noshade size="4" width="10">
will give<b>this is bold</b>
<i>this is italic</i>
<u>this is underlined</u>
they will appear as<center><font size="4" color="RED" face="Comic Sans MS"> Welcome to my home page </font></center>
will appear asThe size can vary from 1 to 7 where 7 is the hight font size. defalut font size is 3. You can also give font as size=+3. this means the size is 6. the defalut for the page is fixed using basefont tag
<basefont size="4" color="RED" face="Comic Sans MS">
Base font will alter the default font from that point onwards to the rest of the document. Font tag will apply to only the text enclosed in that tag.<ul type="disc" compact >
<li type="fillround" >fillround </li>
<li>disc
<li type=square>square
<li type=circle>circle
</ul>
<ol type="1" start =3 >
<li>floppies
<li>hard disk
<li value=7>monitor
<li>cd drive
</ol>
<DL>
<DT>HTTP
<DD>Hyper text transfer protocol
<DT>FTP
<DD>File transfer protocol
</DL>
<img src="jimgraham.gif" alt="jim graham"
width="100" height="100" align="bottom" border="2"
hspace="10" vspace="10">
will appear as
<table border =1 width=50%>
<thead>
<tr><th>head1</th><th>head2</th><th>head3</th></tr>
</thead>
<tbody>
<tr><td>cell11</td><td&t;cell12</td><td>cell13</td></tr>
<tr><td>cell21</td><td>cell22</td><td>cell23</td></tr>
</tbody>
<tfoot>
<tr><td colspan=3 align=center>
this is table footer</td></tr>
</tfoot>
</table>
| head1 | head2 | head3 |
|---|---|---|
| cell11 | cell12 | cell13 |
| cell21 | cell22 | cell23 |
| this is table footer | ||
Table tag can have three sections names thead, tbody, tfoot. They are optional even if you omit then, it wont make any difference to the table.The three section tags in table can be omitted when the cols and rows are to merged to form complicated table.
tr: stands for table row
th : in contained in tr, represents table head cell, given in bold and center aligned.
td : table data given inside tr, is left aligned by defalut
<table summary="sample table" width="100%"
border="2" cellspacing="5" cellpadding="5"
align="center" bgcolor="cyan">
You can have a caption for the table at bottom or top
<caption align="top">mytable</caption>
Make the following table| Name | Marks | ||
|---|---|---|---|
| Access | html | ASP | |
| Shilpa | 21 | 45 | 30 |
| Vaishali | 26 | 30 | 40 |
<table border="1" width=100% bgcolor="#00ffff">
<caption align="top" >marks table </caption>
<tr>
<th rowspan=2 align="left" Valign="bottom">Name</th>
<th colspan=3>Marks</th>
</tr>
<tr align= "Right">
<th>Access</th><th>html</th><th>ASP</th>
</tr>
<tr>
<td>Shilpa</td>
<td align= "Right">21</td>
<td align= "Right">45</td>
<td align= "Right">30</td>
</tr>
<tr>
<td>Vaishali</td>
<td align= "Right">26</td>
<td align= "Right">30</td>
<td align= "Right">40</td>
</tr>
</table>
<body link="#0000ff" vlink="#800000" alink="#ff0000">
The standard colors, blue, maroon, red should not be changed, as visitors are used to these colors.<a href="myhome.html" title="myhome page" >visit my home page</a>
Will appear as<a href="#top">top</a>
will appear as<a name="top">
this is called anchor<a href="page1.html#conclusion">
The above type of link can be used to go to a particular anchor in another page.<a href="TRY.html" > <img src="clb.jpg" border =0 ></a>
When images are used as hyperlinks use border =0 otherwise a blue border will appear around the image. An image can have several hotspots for this we use image map.<img src="clb.jpg" usemap="#mymap">
map can be given anyware on the page<map name ="mymap">
<area shape="rect" coords="52,65,122,89"
href="me.htm">
<area shape="rect" coords="148,65,217,89"
href="you.htm">
</map>
<area shape="rect" coords="0,0,50,100" href=me.htm">
shape can be Circle, rect, polygon,default<big>big</big>
will appeare as big<blink>blink works in Netscape</blink>
<marquee align=left behavior=scroll bgcolor=cyan height=50 width=600 direction=left >
<font size=20>
works in internet explorer. This text will scroll
</font>
</marquee>
<s>strike through</s>
<small>small</small>
smallx<sub>2</sub>
x2x<sup>2</sup>
x2<tt>this is teletype</tt>
this is teletype<cite>citation</cite>
citation<em>emphasizes text</em>
emphasizes text<strong>strong text</strong>
strong text<blockquote>once upon a time there was a king. he was very rich. creates a quotation block </blockquote>
once upon a time there was a king. he was very rich. creates a quotation block
<center>center text</center>
<pre>
comes
where
you
typed
</pre>
will appear as
comes
where
you
typed
<html><head>
<title>New Page 1</title></head>
<frameset rows="64,*">
<frame name="banner" scrolling="no" noresize target="contents" src="aqk.htm">
<frameset cols="150,*">
<frame name="contents" target="main" src="a2.htm">
<frame name="main" src="a3.htm">
</frameset>
<noframes>
<body>This page uses frames, but your browser doesn't support them. </body>
</noframes>
</frameset>
</html>
<a href="a.html" target="main">
this link given in a file in any frame will get opened in the frame main.<a href="b.img" target="_blank">the image</a>
The target attribute in the above tag opens the image file in a new window.<a href="a.html" target="_top">
This target attribute will make the page to burst out of frame. That is frame page will not be displayed. The HTML file will occupy the full view area without any frames.