You are on page 1of 14

HTML

1.What is HTML?
Ans: Hyper text markup language is used to
create a web pages .It allows plain text to be
formatted like bold, italic etc., We can also
insert images, hyperlinks on a web page
2. What are the main requirements to run html
programme?
1. Internet Browser
2. Html editor – notepad
3.What is the structure or syntax of an Html
programme?
Ans: <html>
<head>
</head>
<body>
</body>
</html>
4. What are the file extensions used by html?
Ans: The file extensions are .html, .htm
5.What are the Head and Body section
Ans: The html document is divided into two
categories
(i) Head Section: <Head> and </head>
tags are used to identify the headings or
titles of document <title>.....</title> to
appear the title in browser
(ii) Body section: The body of html
document contains the text that will
show upon the webpage.The body
section enclosed in between
<body>.....</body>
Example1:
<html>
<head>
<title> My first html document
</title>
</head>
<body>
Welcome to my first html page
</body>
</html>
Example2: for background color
<html>
<head>
<title> My first html document
</title>
</head>
<body bgcolor=’green’>
Welocme to my first html page
</body>
</html>
Example3: <br/> tag
<html>
<head>
<title> My first html document
</title>
</head>
<body >
WelcOme to my first html page
<br/>
my page under construction</body>
</html>
Example 4: paragraph tag
<html>
<head><title> THIS IS HTML PAGE
</TITLE>
</HEAD>
<BODY><P> Computer is an electronic
device .It accepts data as input process the
data and displays the result as output
</body>
</html>
Example 5: for bold italic and underline
<html>
<head><title> THIS IS HTML PAGE
</TITLE>
</HEAD>
<BODY><br/>
<U><I><B>WELCOME TO COMPUTER
LAB</B></I></U>
</BODY>
</HTML>
Example 6:
<html>
<head><title> THIS IS HTML PAGE
</TITLE>
</HEAD>
<BODY>
<MARQUEE> Welcome to my web page ..
My page under construction
</marquee>
</body>
</html>
Example 7:
<html>
<head>
<title> THIS IS HTML PAGE
</TITLE>
</HEAD>
<BODY>
<font size="3" color="red">This is some
text!</font>
<font face="verdana" color="green">This is
some text!</font>
<font size="2" color="blue">This is some
text!</font>
</BODY>
</HTML>
ADVANCED HTML
HTML ATTRIBUTES
1. What are HTML Attributes?
Ans: Attributes provide additional
information about html elements
i) HTML elements can have attributes
ii) Attirbutes are always specified in
the start tag
iii) Attributes come in pairs like
name=’value’
2. What is HTML Hyperlinks
Ans: The HTML <a> tag defines a
hyperlink or link is word or group of
words, or image that you can click on to
jump to another document.
3. Write the syntanx for hyperlink
Ans: HTML links are defined with < a>
tag. The link address is specified in the
href attribute.
Syntax:
< a href= “default.htm”>
Example:
<a href=http://www.google.com> this is
a link </a>
4. What does the href attribute contain?
Ans: The HREF is an attribute of
the anchor tag, which is also used to
identify sections within a document. The
HREF contains two components: the
URL, which is the actual link, and the
clickable text that appears on the page,
called the "anchor text."

5. How to insert image in html


Ans: Images are not technically inserted
into a HTML Page. Images are linked to
HTML pages.
The < img> tag creates a holding space
for the referenced image. It is specified
with src attribute.In html the <img> tag
has no end tag.It has two attributes src
and alt.
6. What is ALT in IMG tag?
Ans: The required alt attribute specifies an
alternate text for an image, if the image cannot
be displayed. The alt attribute provides
alternative information for an image if a user
for some reason cannot view it because of slow
connection, an error in the src attribute.
7. Write a HTML program for hyperlink
<html>
<head>
<title> Hyperlink
</title>
<body bgcolor=”yellow”>
<a href=https://www.google.co.in/> Go to
google page </a>
</body>
</head>
</html>

8. Write a html program to insert


image
<HTML>
<HEAD>
<TITLE>Image
</TITLE>
<BODY>
<IMG SRC=”C:\Users\kv2\user backup
2017\Desktop\FILENAME.JPEG”>
</BODY>
</HEAD>
</HTML>
HTML TABLES
1. What is the HTML tag for a table?
Ans Tables are defined with <table> tag.
A table is divided into rows (with the
<tr> tag) 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 contain text, links,
images, lists ,forms and other tables etc.,
2. Write a html program to insert a table
<html>
<table border=”1”>
<tr>
<td> S.NO</td>
<td>S.NAME </td>
<TD> TOTAL MARKS</TD>
</tr>
<tr>
<td>1</td>
<td> XYZ </td>
<TD>600</TD>
</tr>
</table>
</html> If you donot specify a border
attribute , the table will be displayed without
borders.
3. Which is the HTML tag to give heading for
the table?
Ans: Header information in a table are
defined with the <th> tag.All major browsers
are display the text in the <th> element as
bold and centered.
Example:
<html>
<table border=”1”>
<tr>
<th>s.no</th>
<th>s.name</th>
<th>marks</th>
</tr>
<tr>
<td> 1</td>
<td>xyz</td>
<td>600</td>
</tr>
</table>
</html>
4.What is html caption tag?
Ans: The <caption> tag defines a table
caption.
The <caption> tag must be inserted
immediately after the <table> tag. You can
specify only one caption per table.
Example:
<html>
<table border="1">
<caption>Class x students data </caption>
<tr>
<th>s.no</th>
<th>s.name</th>
<th>d.o.b</th>
<th>sex</th>
</tr>
<tr>
<td>1</td>
<td>xyz</td>
<td>1-08-2018</td>
<td>GIRL</td>
</tr>
</table>
</html>
HTML Table Tags

Tag Description
<th> Defines a header cell in a table
<tr> Defines a row in a table
Defines a cell in a table
<td>
<tc> Defines table caption

You might also like