Beruflich Dokumente
Kultur Dokumente
Hypertext
Markup Language
Basically an HTML document is a plain text file that contains text and
nothing else.
When a browser opens an HTML file, the browser will look for HTML
codes in the text and use them to change the layout, insert images, or
create links to other pages.
Since HTML documents are just text files they can be written in even
the simplest text editor.
A more popular choice is to use a special HTML editor - maybe even one
that puts focus on the visual result rather than the codes - a so-called
WYSIWYG editor ("What You See Is What You Get").
However, there are some very good reasons to create your own pages -
or parts of them - by hand...
1
WHY LEARN HTML?
There are excellent editors on the market that will take care of
the HTML parts. All you need to do is layout the page.
You can read the code of other people's pages, and "borrow"
the cool effects.
You can do the work yourself, when the editor simply refuses
to create the effects you want.
You can write your HTML by hand with almost any available text
editor, including notepad that comes as a standard program with
Windows.
All you need to do is type in the code, then save the document,
making sure to put an .html extension or an .htm extension to the
file (for instance "mypage.html").
2
THE HTML TAGS
Although not currently required by all clients, the <html> tag signals
the point where text should start being interpreted as HTML code.
It's probably a good idea to include it in all your documents now, so
you don't have to go back to your files and add it later.
The <html> tag is usually placed on the first line of your document.
At the end of your document you should close with the </html> tag.
3
THE HEAD TAG
For the purposes of this class, only the title tag, below, should be
included in the document head. A typical head section might look
like
<html>
<head>
<title>My First HTML Document</title>
</head>
4
TITLES TAG
Like you might expect, the body tags <body> and </body> define the
beginning and end of the bulk of your document. All your text,
images, and links will be in the body of the document.
The body should start after the head. A typical page might begin
like
<html>
<head>
<title>My First HTML Document</title>
</head>
<body>
5
HEADERS TAGS
<html>
<head>
</head>
</html>
6
Output of This Are As Follows
7
PARAGRAPHS TAGS
<pre>this is an example
of a preformatted
text tag</pre>
8
BOLDFACE AND ITALICS TAGS
You can add emphasis to text by using the boldface and italic tags
or the emphasis and strong tags.
There is an underline tag as well, but most people don't use it since
text that is linked is often underlined. The potential for confusion
and the archaic nature of underlining in general make it a poor
marker for emphasis.
When using these tags, you usually cannot (and probably should not)
have text that is both boldface and italics; the last tag
encountered is usually the tag that is displayed. For example, if you
had a boldface tag followed immediately by an italic tag, the tagged
word would appear in italics.
<html>
<head>
<title>friends</title>
</head>
<body><b>Hello...</b><i>How are you???</i>
</body>
</html>
9
Physical tags
Logical tags
10
LISTS TAGS
When using lists, you have no control over the amount of space
between the bullet or list number, HTML automatically does this
for you. Neither (as yet) do you have control over what type of
bullet will be used as each browser is different.
Unnumbered lists are started with the <ul> tag, followed by the
actual list items, which are marked with the <li> tag. The list is
ended with the ending tag </ul>.
<ul>
<li> list item 1
<li> list item 2
<li> list item 3
</ul>
list item 1
list item 2
list item 3
11
Here is the same list using a numbered list format:
<ol>
<li> list item 1
<li> list item 2
<li> list item 3 </ol>
list item 1
list item 2
list item 3
This is a term
This is a definition.
And yet another definition.
Another term
Another definition
Nested lists Tags
12
Finally, here is a nested list within an unnumbered list (we could
just have easily had a nested list within a numbered list).
<ul>
<li> list item 1
<ul>
<li> nested item 1
<li> nested item 2
</ul>
<li> list item 2
<ul>
<li> nested item 1
<li> nested item 2
</ul>
<li> list item 3
<ul>
<li> nested item 1
<li> nested item 2
</ul>
</ul>
list item 1
nested item 1
nested item 2
list item 2
nested item 1
nested item 2
list item 3
nested item 1
nested item 2
BLOCKQUOTE TAGS
13
The blockquote tag indents the text (both on the left and right)
inside the tags. The blockquote tag looks like this:
<blockquote>...</blockquote>
CENTER TAGS
You can center text, images, and headings with the center tag:
The center tag automatically inserts a line break after the closing
center tag.
ADDRESSES TAGS
14
<body>What is sweet but not Honey,
Precious but not Money,
Bright but not Sunshine,
Improves with time but not Wine???
Its....MY FRIENDSHIP!!!
<address> akshay_style123yahoo.com
</body>
STRIKE-THROUGH
15
Should you want it, there is a strike-through tag which displays
text with a strike.
displays as :
There are really only three basic tags for a table. They are:
<table> = table tag <tr> = table row <td> = table data
Now the fun begins when we start to add to the table. Remember
when you were little and you would build playing card houses, that
the most important thing was the foundation? Well the same
applies to HTML Tables. By properly placing the tag, with the right
16
attributes you will build the solid foundation you need to make a
great card house, oops I mean table.
I would like to make a 3 column, 3 row table so you can see a basic
table, then we will add attributes to it, to flavor it up. So, lets get
started!
It is at this point I would like to remind you that most HTML tags
require and en tag. This is especially important with table tags. One
missing </td> and the table might not show up or could be skewed.
From here on, I will only print the HTML Code that changes. This
will help you to see what has changed, and how it looks in both the
HTML and on screen.
17
Cell 7 Cell 8 Cell 9
Next we will add some cellpadding to the table. This gives each cell
some space to breathe. So add CELLSPACING=5 to the table tag.
Align and Valign can be used in td,tr, and table tags. Cellpadding,
Cellspacing and Border should only be used in the table tag.
Cell 1
18
Cell 7 Cell 8 Cell 9
To accomplish this, you have to use the colspan attribute. Just add
colspan=2 to the <td>, and bam!
Cell 2 Cell 3
Cell 8 Cell 9
Here is a list of all table attributes; you should consider this your,
"cheat sheet."
19
Cell Padding <TABLE CELLPADDING=?>
Desired Width <TABLE WIDTH=?> (in pixels)
Width Percent <TABLE WIDTH="%"> (percentage of
page)
Table Row <TR></TR>
Alignment <TR ALIGN=LEFT|RIGHT|
CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>
Table Cell <TD></TD> (must appear within
table rows)
Alignment <TD ALIGN=LEFT|RIGHT|
CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>
No linebreaks <TD NOWRAP>
Columns to Span <TD COLSPAN=?>
Rows to Span <TD ROWSPAN=?>
Desired Width <TD WIDTH=?> (in pixels)
Width Percent <TD WIDTH="%"> (percentage of
table)
Cell Color <TD BGCOLOR="#$$$$$$">
Table Header <TH></TH> (same as data,
except bold
centered)
Alignment <TH ALIGN=LEFT|RIGHT|
CENTER|MIDDLE|BOTTOM
VALIGN=TOP|BOTTOM|MIDDLE>
No Linebreaks <TH NOWRAP>
20
<html>
<head><b><center><h1><tt>This is my first
table</tt></h1></center></b></head><br><br><br><br>
<title>akshay</title>
<body BGcolor="sky blue"></body>
<table Border=5 width=60% align=center tablecolor="red">
<tr>
<th rowspan=2>name
<th colspan=3>marks
</tr>
<tr>
<th> english
<th> science
<th> punjabi
</tr>
<tr align=center>
<td> akshay
<td> 58
<td> 89
<td> 56
</tr>
<tr align=center>
<td> navjot
<td> 45
<td> 96
<td>78
</tr>
<captionalign=top><big><b><h2>marks
sheet</h2></big><b></caption></table></html>
21
HTML COMMANDS FOR LINKS
22
The text that appears between the beginning and ending tags
("Welcome to NCSU" in the above example) is the text that is the
link the reader clicks on to go to that URL.
When you make a link, imagine you're creating two anchor points:
one exists in your document (the text to click on), while the other
is the document to which you're linking. You basically create a
thread between two points.
As long as you know the URL for a file, you can create a link to it.
Linking to a named anchor
23
<a name="important">First sentence in fourth paragraph</a>
Next, create the link to this "important" anchor (at the start
of "chapter2.html"). It would look like:
The pound sign in front of the anchor name tells the browser to
look for the link inside the document already loaded instead of
looking elsewhere in another file.
Note that anchor names are case sensitve, and that some kind of
non-blank text must appear in the named anchor tag.
There may be times when you not only want to link to a specific
document, but more precisely, you want to link to a particular
section of that other document. As an example, suppose you wish to
set up a link from the document "Our first HTML document" to a
particular section in a second document called "chapter2.html".
First, you set up a named anchor in the document you are linking to
(chapter2.html). To do this, go to the section in your second
document where you want the reader to begin and define a named
anchor. Name this anchor "important". Insert the following tag in
the appropriate place in the second document:
24
<a href="http://www.here.edu/chapter2.html#important">important
part</a>
A user would see that the first document has the words "important
part" highlighted. Clicking on this highlighted text would take them
to the "important" section in the second document.
If a new neighbor you just met on the street asked you where you
lived, you wouldn't give them your complete postal address. You'd
say something like "two houses down on the left." Your postal
address is your "absolute" address -- anyone can find you using the
information it provides. The information you gave to your new
neighbor is your "relative" address -- just enough information to
locate your house from where you were standing.
The same concept works with URL addresses. When linking from
one document to another in the same directory, only the second
document name is necessary, not the entire URL. For example
25
only within files that are part of a single project (such as this
HTML tutorial).
<html>
<head>
<title>friends</title>
</head>
<bodybackground="E:\akshay\Gallery\3-Dimentional\3
Dimensionals 000052.jpg"> <center>"Today, tommorow and
yesterday there will be
one heart that would always beat for you<br>
You know Whose???<br>
your Own Stupid!!!"<br></center><img width=50 height=65 >
<center><h4>THIS IS THE LINKS.</H4>
<OL TYPE="1">
<LI><A HREF="nav.htm">HTML </A>
<LI><A HREF="akshay.htm">AKSHAY</A>
<LI><A HREF="89.htm">ATUL</A>
<LI><A HREF="ap.htm">PAWAN</A>
<LI><A HREF="n.html">ARTI</A>
<LI><A HREF="hr tag.htm">HASHIMA</A>
<LI><A HREF="font tag.htm">NAVJOT</A></OL></center>
</body>
</html>
26
27