HTML Classes
HTML Classes
HTML Tags
Ex: <b><i>welcome</i></b>
<br> is an empty element without a closing tag (it defines a line break).
In XHTML, XML, and future versions of HTML, all elements must be closed. Ex: <br/>
HTML Attributes
<html>
This tag is used to indicate that this is a HTML document. Most HTML documents should start and end with this tag.
<head>
This tag is used to indicate the header section of the HTML document, which typically includes the <title> and <meta> tags, and is
not displayed in the main window of the browser.
<title>
The title is what is displayed on the upper left corner of your browser when you view a web page..
<meta>
The <meta> tag information is not directly displayed when the page is rendered on the browser. Rather, this is
used for the author of the HTML page to record information related to this page. Two common attributes are
name and content.
<body>
The <body> tag may contain several attributes are listed below:
Attribute Description
link
Specifies the default color of unvisited links in a document
text Specifies the color of the text in a document
<body background="background.jpg">
<html>
<head>
<title>
Here is the title of the HTML document.
</title>
<meta name="Ganesh " content="Sample HTML " />
</meta>
</head>
<body bgcolor="ff00ff”>
Here is the body of the HTML document.
</body>
</html>
o/p>--------------------------
Here is the body of the HTML document.
Heading Styles
<html>
<body>
</body>
</html>
0/p>---------------------------------------------------
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
<html>
<body>
</body>
</html>
o/p>--------------------------------------------------
<pre>
This is
preformatted text.
It preserves both spaces
and line breaks.
</pre>
<pre>
for i = 1 to 10
print i
next i
</pre>
</body>
</html>
o/p>--------------------------------
This is
preformatted text.
It preserves both spaces
and line breaks.
for i = 1 to 10
print i
next i
<html>
<body>
<code>Computer code</code>
<br>
<kbd>Keyboard input</kbd>
<br>
<tt>Teletype text</tt>
<br>
<samp>Sample text</samp>
<br>
<var>Computer variable</var>
<br>
<p>
<b>Note:</b> These tags are often used to display computer/programming code.
</p>
</body>
</html>
p/p>-----------------------------------------
Computer code
Keyboard input
Teletype text
Sample text
Computer variable
Note: These tags are often used to display computer/programming code.
<html>
<body>
<address>
Millennium Software Solutions<br>
Dwarakanagar<br>
Vizag<br>
INDIA
</address>
</body>
</html>
o/p>--------------------------------------------
Millennium Software Solutions
Dwarakanagar
Vizag
INDIA
Tag Description
<q> The <q> tag is supported in all major browsers, except Internet Explorer.
Ex:
<html>
<body>
</body>
</html>
o/p>-----------------------------------------------------------------------------
UN
WWW
The title attribute is used to show the spelled-out version when holding the mouse pointer over the acronym or
abbreviation
The <bdo> tag allows you to specify the text direction and override the bidirectional algorithm.
<html>
<body>
<p>
If your browser supports bi-directional override (bdo), the next line will be written from the right to the left (rtl):
</p>
<bdo dir="rtl">
Here is some Hebrew text
</bdo>
</body>
</html>
o/p>-----------------------------------------------------------
If your browser supports bi-directional override (bdo), the next line will be written from the right to the left (rtl):
<html>
<body>
<var>Variable</var><br />
<cite>Citation</cite>
</body>
</html>
O/P>-----------------------------------------------
Emphasized text
Strong text
Definition term
Computer code text
Sample computer code text
Keyboard text
Variable
Citation
1) Ordered List
2) Unordered List
3) Definition List
1) Ordered List:- list with numbers( 1,2,3 (or) a,b,c,.. (or) A,B,C,.. (or) i,ii.iii,… (or) I,II,III,…)
<ol> tag (Order list)
<li> tag (List Item)
<body>
<ol >
<li> Java </li>
<li> ASP </li>
<li> PHP </li>
</ol>
</body>
Example for Ordered List with Start Number and/or Type attributes:
<body>
<ol start=10>
<li> Java </li>
<li> ASP </li>
<li> PHP </li>
</ol>
</body>
<body>
<ul Type="circle">
<li> PHP </li>
<li> JAVA </li>
</ul>
</body>
Note : In Unordered list Default bullet is Disk. We can write OL in UL. We can write OL in OL. We can write UL
in OL. We can write UL in UL.
<html>
<head>
</head>
<body>
<ol>
<ul>
</ul>
</ol>
</body>
</html>
Definition List
<body bgcolor=violet>
<strong>
Drinks
</strong>
<hr color=brown>
<dl>
<dt> Pepsi</dt>
<dd>Health Drink</dd>
<dd>Contains Chocolate</dd>
</dl>
</body>
Images
If both html file and image in the same folder then no need to give path
Example
<html>
<body>
</body>
</html>
Setting the height adjusts width and vice-versa. Pick the Image from Different Folder In your Folder
Example
<html>
<body>
</body>
</html>
Example
Pick the Image from Different Folder which is out of your Folder
<html>
<body>
</body>
</html>
Links
Using anchor <a> tags we can establish the links form one page to another Page.
Example
red.html
<hr/>
</body>
green.html
<hr>
<hr>
</body>
<body bgcolor=yellow>
<hr>
</body>
Target = "_self” Opens the target Page in same page. (It is Default ) .
Example
<html>
<head>
</head>
<body>
</body>
</html>
<html>
<head>
</head>
<body>
</dody>
</html>
Example
<body>
</body>
Example
<html>
<head>
</head>
<body>
</body>
</html>
<font> TAG:-
EX:
Frames
Example
<html>
<head>
</head>
<frameset rows="20%,50%,30%">
<frame src="a.html">
<frame src="b.html">
<frame src="c.html">
</frameset>
</html>
Example
<html>
<head>
</head>
<frameset rows="50%,50%">
<frameset cols="50%,50%">
<frame src="b.html">
<frame src="c.html">
</frameset>
</frameset>
</html>
Note : If the browser is not supporting frames then <noframes> will Execute.
<noframes>
<body>
</body>
</noframes>
Target
<html>
<head>
</head>
<frameset cols="50%,50%">
<frame src="links.html">
</frameset>
</html>
Links.html
<html>
<head>
</head>
<body>
</body>
</html>
Inline Frame
Example
<html>
<head>
</head>
<body>
<p>This is a Paragraph</p>
<ol>
</ol>
</body>
</html>
Designing Tables
Example
<html>
<head>
</head>
<body >
<table border=1>
<tr>
</tr>
<tr>
</tr>
</table>
</body>
</html>
Example
<html>
<head>
</head>
<body >
<tr>
</tr>
<tr>
<td> 1 </td>
</tr>
<tr>
<td> 2 </td>
</tr>
</table>
</body>
</html>
Example
<html>
<head>
</head>
<body >
<tr>
<td> 1 </td>
</tr>
</tfoot>
<tr>
<td> 2 </td>
</tr>
<thead>
<tr>
</tr>
</thead>
<tbody>
<tr>
<td> 3 </td>
</tr>
</tbody>
</table>
</body>
</html>
Table Attributes
Bgcolor
Background
Border
Height
Width
Examples
If you give both bgcolor and background for a single table then high Priority is given for background
Valign will not work in HTML so we have to write CSS coding instead of Valign
Attributes of TD
Bgcolor
Background
Width
Height
Col span
Row span
Example 1
<tr>
</tr>
<tr>
<td> 2 </td>
</tr>
</table>
For Height complete Row will be affected. For Width complete Column will be affected
Example 2
<table border=10>
<tr>
</tr>
<tr>
</tr>
</table>
Example 3
<tr>
</tr>
<tr>
</tr>
</table>
<html>
<head>
</head>
<body >
<tr>
<tr>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>
Designing Forms
<html>
<body>
<br>
<select name=country>
</select>
<br>
</select>
<br>
Complete Address <br>
</form>
</body>
</html>
Note : In text box we can give attribute maxlength to restrict the length of text. In a Text Box Maximum we can give 160 characters. In
List Box we can select multiple items with using attribute multiple. Every Object should have name , id ( names can be same but id s
must be unique). If you select radio buttons or check boxes or combo boxes or list boxes then the value will be returned, so value
attribute is recommended for these objects.
XHTML consists of all the elements in HTML 4.01, combined with the strict syntax of XML.
Why XHTML?
The following HTML code will work just fine if you view it in a browser (even if it does NOT follow the HTML rules):
<html>
<head>
<body>
<h1>Bad HTML
</body>
XML is a markup language where everything must be marked up correctly, which results in "well formed" documents. XML is designed
to describe data, and HTML is designed to display data. Some browsers run on computers, and some browsers run on mobile phones or
other small devices. mobile phones or other small devices do not have the resources or power to interpret a "bad" markup language.
Therefore by combining HTML and XML, and their strengths, we got a markup language that is useful now and in the future is XHTML.
Get Ready For XHTML. XHTML is not very different from the HTML 4.01 standard. So, bringing your code up to the 4.01 standard is a
good start. In addition, you should start NOW to write your HTML code in lowercase letters, and NEVER skip closing tags (like </p>).
In HTML, some elements can be improperly nested within each other, like this:
In XHTML, all elements must be properly nested within each other, like this:
Note: A common mistake with nested lists, is to forget that the inside list must be within <li> and </li> tags.
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
<li>Milk</li>
</ul>
This is correct:
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Notice that we have inserted a </li> tag after the </ul> tag in the "correct" code example. XHTML Elements must be Closed. Nonempty
elements must have a closing tag.
This is wrong
<p>This is a paragraph
This is correct
<p>This is a paragraph</p>
Empty Elements Must Also Be Closed. Empty elements must also be closed.
This is wrong
A break: <br>
This is correct
This is wrong:
<BODY>
<P>This is a paragraph</P>
</BODY>
This is correct:
<body>
<p>This is a paragraph</p>
</body>
All XHTML elements must be nested within the <html> root element. Child elements must be in pairs and correctly nested within their
parent element.
<html>
</html>