HTML Viva Questions
HTML Viva Questions
Features of HTML
1) It is a very easy and simple language. It can be easily understood and modified.
3) It is a markup language, so it provides a flexible way to design web pages along with the
text.
4) It facilitates programmers to add a link on the web pages (by html anchor tag), so it enhances
the interest of browsing of the user.
6) It facilitates the programmer to add Graphics, Videos, and Sound to the web pages which
makes it more attractive and interactive.
7) HTML is a case-insensitive language, which means we can use tags either in lower-case or
upper-case.
1) What is HTML?
HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a
standard text formatting language which is used to create and display pages on the Web. It
makes the text more interactive and dynamic. It can turn text into images, tables, links.
Hyper Text: HyperText simply means "Text within Text." A text has a link within it, is a
hypertext. HyperText is a way to link two or more web pages (HTML documents) with each
other.
Markup language: A markup language is a computer language that is used to apply layout and
formatting conventions to a text document. Markup language makes text more interactive and
dynamic. It can turn text into images, tables, links, etc.
Web Page: A web page is a document which is commonly written in HTML and translated by a
web browser. A web page can be identified by entering an URL. A Web page can be of the static
or dynamic type.
Let's see a simple example of HTML.
<html>
<head>
<title>Web page title</title>
</head>
<body>
<h1>Write Your First Heading</h1>
<p>Write Your First Paragraph.</p>
</body>
</html>
<html > :This tag informs the browser that it is an HTML document. Text between html tag
describes the web document.
<head>: It should be the first element inside the <html> element, which contains the
metadata(information about the document). It must be closed before the body tag opens.
<title>: As its name suggested, it is used to add title of that HTML page which appears at the
top of the browser window. It must be placed inside the head tag and should close
immediately. (Optional)
<body> : Text between body tag describes the body content of the page that is visible to the end
user. This tag contains the main content of the HTML document.
<h1> : Text between <h1> tag describes the first level heading of the webpage.
<p> : Text between <p> tag describes the paragraph of the webpage.
HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are
unclosed tags.
o content, and
o tags
When a web browser reads an HTML document, the browser reads it from top to bottom and
left to right. HTML tags are used to create HTML documents and render their properties. Each
HTML tags have different properties.
Syntax
<tag> content </tag>
Content is placed between tags to display data on the web page.
Tags are the primary component of the HTML that defines how the content will be structured/
formatted, whereas Attributes are used along with the HTML tags to define the characteristics
of the element. For example, <p align=” center”>Interview questions</p>, in this the ‘align’ is
the attribute using which we will align the paragraph to show in the center of the view.
No. There are some HTML tags that don't need a closing tag. For example: <image> tag, <br>
tag
The HTML formatting is a process of format the text for a better look and feel. It uses different
tags to make text bold, italicized, underlined.
The HTML contains six types of headings which are defined with the <h1> to <h6> tags. Each
type of heading tag displays different text size from another. So, <h1> is the largest heading tag
and <h6> is the smallest one. For example:
<h1>Heading no. 1</h1>
<h2>Heading no. 2</h2>
<h3>Heading no. 3</h3>
<h4>Heading no. 4</h4>
<h5>Heading no. 5</h5>
<h6>Heading no. 6</h6>
The HTML provides an anchor tag to create a hyperlink that links one page to another page.
These tags can appear in any of the following ways:
8) Which HTML tag is used to display the data in the tabular form?
You can create a table using the <table> element. Inside the <table> element, you can use the <tr> elements to
create rows, and to create columns inside a row you can use the <td> elements.
<table> <tr> <th>No.</th> <th>Name</th> <th>Age</th> </tr> <tr> <td>1</td> <td>Peter Parker</td>
<td>16</td> </tr> <tr> <td>2</td> <td>Clark Kent</td> <td>34</td> </tr> </table>
Spanning allow you to extend table rows and columns across multiple other rows and columns.
Normally, a table cell cannot pass over into the space below or above another table cell. But, you can use
the rowspan or colspan attributes to span multiple rows or columns in a table.
9) What are some common lists that are used when designing a page?
There are many common lists which are used to design a page. You can choose any or a
combination of the following list types:
o Ordered list - The ordered list displays elements in numbered format. It is represented
by <ol> tag.
o Unordered list - The unordered list displays elements in bulleted format. It is
represented by <ul> tag.
o Definition list - The definition list displays elements in definition form like in dictionary.
The <dl>, <dt> and <dd> tags are used to define description list.
No, you can use hyperlinks on text and images both. The HTML anchor tag defines a hyperlink
that links one page to another page. The "href" attribute is the most important attribute of the
HTML anchor tag.
Syntax
<a href = "..........."> Link Text </a>
A style sheet is used to build a consistent, transportable, and well-designed style template. You
can add these templates on several different web pages. It describes the look and formatting of a
document written in markup language.
12) Can you create a multi-colored text on a web page?
Yes. To create a multicolor text on a web page you can use <font color ="color"> </font> for the
specific texts you want to color.
Marquee is used to put the scrolling text on a web page. It scrolls the image or text up, down,
left or right automatically. You should put the text which you want to scroll within the
<marquee>......</marquee> tag.
To make a picture a background image on a web page, you should put the following tag code
after the </head> tag.
<body background = "image.gif">
Here, replace the "image.gif" with the name of your image file which you want to display on
your web page.
Cell Spacing is the space or gap between two consecutive cells. Whereas, Cell Padding is the
space or gap between the text/ content of the cell and the edge/ border of the cell. Please refer
to the above figure example to find the difference.
18. How can we club two or more rows or columns into a single row or column in an HTML
table?
HTML provides two table attributes “rowspan” and “colspan” to make a cell span to multiple
rows and columns respectively
19. In how many ways can we specify the CSS styles for the HTML element?
There are three ways in which we can specify the styles for HTML elements:
Inline: Here we use the ‘style’ attribute inside the HTML element.
Internal: Here we use the <style> tag inside the <head> tag. To apply the style we bind the
elements using ‘id’ or ‘class’ attributes.
External: Here we use the <link> tag inside <head> tag to reference the CSS file into our HTML
code. Again the binding between elements and styles is done using ‘id’ or ‘class’ attributes.
The HTML form is used to collect the user inputs. HTML provides a <form> tag to create forms.
To take input from the user we use the <input> tag inside the form so that all collected user
data can be sent to the server for processing. There are different input types like ‘button’,
‘checkbox’, ‘number’, ‘text’, ‘password’, ‘submit’ etc.
<form action="/submit_data.php">
<label>Enter your name: </label>
<input type="text" name="name" />
<label>Enter Mobile number </label>
<input type="number" name="mobile_no"/>
<input type="submit" value="Submit">
</form>
HTML5 provides two tags: <audio> and <video> tags using which we can add the audio or
video directly in the webpage