Professional Documents
Culture Documents
Sandeep Kumar
Introduction
A Simple Example
<html>
<head>
< t i t l e >F i r s t HTML Page</ t i t l e >
</head>
<body>
<h1>My F i r s t Heading </h1>
<p>My f i r s t Par agra p h </p>
</body>
</html>
HTML Tags
HTML tags are keywords (tag names) surrounded by angle brackets. The
general syntax is:
An HTML tag creates ‘markers’ for web browser to read and interpret.
These ‘markers’ tell the web browser what and how to display contents on
the web page.
The first tag is called ‘opening’ tag and second tag is called ‘closing’ tag.
HTML elements can also be nested, we can see from previous example that the head element
lies within html element.
Basic Elements
html: The html element tells the web browser that you are writing a HTML document.
The text between the opening tag <html> and closing tag </html> describes a HTML
document. It is a necessary element in every HTML document.
head: The head element contains information about the HTML document that does not
appear on the web page. For example, the title element. In the head element, we can
define the style attribute of other HTML elements.
title: The title element sets the title of the web page. Though, it is not a necessary
element but it is recommended to give a meaningful title to each web page.
body: The body element describes the visible contents of the web page, i.e. the contents
define inside body element will be shown on the web page. It’s a necessary element in
every HTML document.
HTML Attribute
One can use any text editor to write html code. Today many advanced html editors are
available free of cost. Even, the notepad available in all Windows system can work.
Save the file by giving its name index.html or any other name. Do not forget to put the
file extension as ‘.html’ or ‘.htm’ while saving file.
Headings
The HTML headings can be made using the six heading tags
<h1>, <h2>, <h3>, <h4>, <h5>, <h6>. The <h1> tag is used for highest precedence
paragraph and <h6> for lowest precedence paragraph. http:/
<html>
<body>
This is heading 5
</body>
</html>
This is heading 6
Paragraph
<html>
<body>
<p>The s k i l l e d b a s e p a p e r L a t e x and HTML
i n t r o d u c e d u n d e r CBCS p a t t e r n i s a n i c e
i n i t i a t i v e . T h i s p a p e r i s o f two c r e d i t . </p>
<p>Through t h i s p a p e r s t u d e n t s can l e a r n
how t o p r o d u c e p r o f e s s i o n a l documents and
p r e s e n t a t i o n s i n l a t e x . HTML w i l l h e l p them
t o c r e a t e s i m p l e web p a g e s .</p>
</body>
</html>
Text Formatting
HTML provides tags for making text italic, bold, subscript, superscript, marked, deleted etc.
These tags are summarized in following table:
Text Formatting
<html>
<body> This text is normal.
<p>T h i s t e x t i s n o r m a l .</p>
This text is bold.
<p><b>T h i s t e x t i s b o l d .</b></p>
This text is italic.
<p><i>T h i s t e x t is i t a l i c .</ i ></p>
Font
Using the tag <font>, one can specify the font family, font size and color of the text. The
<font> tag can take following attributes:
Text Formatting
<html>
<body>
</body>
</html>
Making List
The HTML tags for ordered and unordered list are <ol> and <ul> respectively. The HTML tag
for a list element is <li>.
http:
<html> <body>
</body> </html>
Changing Bullets
One can change the bullets to circle, disc or square in an unordered list using the type attribute.
A type attribute can take values "circle", "square", "disc" or "none".
<html> <body>
</body> </html>
<html>
<body> http
<h3>O r d e r e d L i s t w i t h A r a b i c n u m e r a l s </h3>
<o l t y p e =”1”> Ordered List with Arabic numerals
<l i >A n a l y s i s </ l i >
<l i >A l g e b r a </ l i > 1. Analysis
<l i >D i f f e r e n t i a l E q u a t i o n s </ l i > 2. Algebra
</o l> 3. Differential Equations
<h3>O r d e r e d L i s t w i t h roman n u m e r a l s </h3>
<o l t y p e =” i ”>
Ordered List with roman numerals
<l i >A n a l y s i s </ l i >
i. Analysis
<l i >A l g e b r a </ l i >
ii. Algebra
<l i >D i f f e r e n t i a l E q u a t i o n s </ l i >
iii. Differential Equations
</o l>
</body>
</html>
Sandeep Kumar (SBSC, DU) HTML July 23, 2017 19 / 27
Introduction
Creating Tables
HTML provides tags to make tables. Different tags for rows, data and headings are :
Creating Table
<html> <body>
<t a b l e b o r d e r =”1”>
<c a p t i o n >S t u d e n t s Marks Record </c a p t i o n >
<t r >
<th>S t u d e n t Name</th>
<th>A n a l y s i s Marks</th>
<th>A l g e b r a Marks</th>
</t r >
<t r > Students Marks Record
<td>Ruhani </td> Student Name Analysis Marks Algebra Marks
<td >90</td>
<td >95</td> Ruhani 90 95
</t r >
<t r > Meera 85 92
<td>Meera</td>
<td >85</td> Satvik 95 88
<td >92</td>
</t r >
<t r >
<td>S a t v i k </td>
<td >95</td>
<td >88</td>
</t r >
</t a b l e >
</body> </html>
Inserting Images
HTML provides the tag <img> to insert images in web page. Different attributes specifying
source of image, width, height are:
Inserting Image
<html>
<body>
</body>
</html>
If image lies on some server then one can include that image by specifying its web address. For
example, to include shown Delhi University icon, one can specify its web address, which is
http://du.ac.in/uod/Logos/uod1.png as src attribute.
Videos
HTML provides tags to insert videos in web pages. Different tags specifying source of video,
width, height and controls are:
Tag/Attribute Description
<video> Insert Video
<type> Specify type of video; mp3 or Ogg or WebM
<controls> Insert controls buttons, start, stop, pause etc.
<width> Width of video
<height> Height of video
Inserting Video
http://w
<html>
<body>
</body>
</html>
Youtube Video
To include Youtube Videos, copy the Embed code and paste it inside the body of HTML page.
<html>
<body>
<i f r a m e w i d t h =”420” h e i g h t =”315”
s r c =” h t t p s : / /www . y o u t u b e . com/ embed /X9zKg−Nkauk ”
f r a m e b o r d e r =”0” a l l o w f u l l s c r e e n ></i f r a m e >
</body>
</html>
Links
What makes HTML a hypertext language is the ability to move from one web page to another
web page. The anchor tag <a> is used to insert links in a web page. Syntax for this tag is: