1. What is HTML?
HTML stands for Hyper Text Markup Language and is the language of the
internet. It is the standard text formatting language used for creating and
displaying pages on the Internet
HTML documents are made up of the elements and the tags that format it
for proper display on pages.
2. What are HTML tags?
We use HTML tags for placing the elements in the proper and appropriate
format. Tags use the symbols <, and > to set them apart from the HTML
content.
The HTML tags need not be closed always. For example, in the case of
images, the closing tags are not required as <img> tag.
3. What are HTML Attributes?
Attributes are the properties that can be added to an HTML tag. These
attributes change the way the tag behaves or is displayed. For example, a
<img> tag has a src attribute, which you use to add the source from
which the image should be displayed.
We add attributes right after the name of the HTML tag, inside the
brackets. We can only add the attributes to opening or self-closing tags,
but never be in closing tags.
4. What is a marquee in HTML?
Marquee is used for scrolling text on a web page. It scrolls the image or
text up, down, left, or right automatically. To apply for a marquee, you
have to use </marquee> tags.
5. How do you separate a section of texts in HTML?
We separate a section of texts in HTML using the below tags:
<br> tag – It is used to separate the line of text. It breaks the current line
and shifts the flow of the text to a new line.
<p> tag–This tag is used to write a paragraph of text.
<blockquote> tag–This tag is used to define large quoted sections.
6. Define the list types in HTML?
The list types in HTML are as below:
Ordered list–The ordered list uses <ol> tag and displays elements in a
numbered format.
Unordered list–The unordered list uses <ul> tag and displays elements in
a bulleted format.
Definition list–The definition list uses <dl>, <dt>, <dd> tags and displays
elements in definition form like in a dictionary.
7. Differentiate between an Ordered list and an Unordered list?
An unordered list uses <ul> </ul> tags and each element of the list is
written between <li> </li> tags. The list items are displayed as bullets
rather than numbers.
An ordered list uses <ol> </ol> tags and each element of the list is
written between <li> </li> tags. The list items are displayed as numbers
rather than bullet points.
<!DOCTYPE html>
<html>
<body>
<h2>HTML List Example</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
8. What is the difference between HTML and CSS?
HTML is used to create the structure and content of a web page, while CSS
is used to define the appearance and layout of the page.
9. How do you display a table in an HTML webpage?
The HTML <table> tag is used to display data in a tabular format. It is also
used to manage the layout of the page, for example, header section,
navigation bar, body content, footer section. Given below are the list of
HTML tags used for displaying a table in an HTML webpage:
Tag Description
<table> It defines a table.
<tr> It defines a row in a table.
It defines a header cell in a
<th>
table.
<td> It defines a cell in a table.
<caption> It defines the table caption
It specifies a group of one o
<colgroup> more columns in a table for
formatting.
It is used with <colgroup>
<col> element to specify column
properties for each column
It is used to group the body
<tbody>
content in a table.
It is used to group the
<thead>
header content in a table.
It is used to group the foote
<tfooter>
content in a table.
10. How do you create a hyperlink in HTML?
We use the anchor tag <a> to create a hyperlink in HTML that links one
page to another page. The hyperlink can be added to images too.
11. How do you add buttons in HTML?
We can use the built-in Button tag in HTML to add buttons to an HTML web
page.
<!DOCTYPE html>
<html>
<body>
<h2>HTML Button Tag Example</h2>
<button name="button" type="button">CLICK ME</button>
</body>
</html>
12. What are the different types of headings in HTML?
There are six types of heading tags in HTML which are defined with the
<h1> to <h6> tags. Each type of heading tag displays a different text
size from another. <h1> is the largest heading tag and <h6> is the
smallest. For example:
<!DOCTYPE html>
<html>
<body>
<h1>This is Heading 1</h1>
<h2>This is Heading 2</h2>
<h3>This is Heading 3</h3>
<h4>This is Heading 4</h4>
<h5>This is Heading 5</h5>
<h6>This is Heading 6</h6>
</body>
</html>
13. How do you insert an image in the HTML webpage?
You can insert an image in the HTML webpage by using the following
code:
<!DOCTYPE html>
<html>
<body>
<h2>HTML Image Example</h2>
<img src="[Link]" />
</body>
</html>
14. How are hyperlinks inserted in the HTML webpage?
You can insert a hyperlink in the HTML webpage by using the following
code:
<!DOCTYPE html>
<html>
<body>
<h2>HTML Hyperlink Example</h2>
<a href="url">link text</a>
</body>
</html>
15. How do you add colour to the text in HTML?
You can add colour to the text in HTML by using the following code:
<!DOCTYPE html>
<html>
<body>
<h2>HTML Color Text Example</h2>
<h1 style="color: Red">Hello HTML</h1>
<p style="color: Blue">Line 1</p>
<p style="color: Green">Line 2</p>
</body>
</html>
16. How do you add CSS styling in HTML?
There are three ways to include the CSS with HTML:
Inline CSS: It is used when less amount of styling is needed or in cases
where only a single element has to be styled. To use inline styles add the
style attribute in the relevant tag.
External Style Sheet: This is used when the style is applied to many
elements or HTML pages. Each page must link to the style sheet using the
<link> tag:
<head>
<link rel="stylesheet" type="text/css" href="[Link]" />
</head>
Internal Style Sheet: It is used when a single HTML document has a unique
style and several elements need to be styled to follow the format. Internal
styles sheet is added in the head section of an HTML page, by using the
<style> tag:
<head>
<style type="text/css">
hr { color: sienna; }
p{ margin-left: 20px; }
body { background-image: url("images/[Link]"); }
</style>
</head>
[Link] is the ‘class' attribute in HTML?
The ‘class' attribute in HTML defines a class for an HTML element. It can be used
to apply a specific style to a group of elements on a web page.
[Link] is the difference between the ‘id' and ‘class' attributes of HTML
elements?
The ‘id' attribute defines a unique identifier for an HTML element, while the
‘class' attribute defines a class for a group of elements. An ‘id' can only be used
once on a page, while a ‘class' can be used multiple times.
[Link] is the difference between HTML and HTML5?
HTML5 is the latest version of HTML and includes new features and
improvements over previous versions. Some key differences between HTML and
HTML5 include support for multimedia elements (such as video and audio),
improved semantics, and better support for mobile devices.
[Link] is the role of the <head> tag in HTML?
The <head> tag defines information about the web page that is not displayed on
the page itself, such as its title, keywords, and other metadata. It is located
between the <html> and <body> tags and is usually the first element in the
document.
21. What is the role of the <meta> tag in HTML?
The <meta> tag provides additional information about the web page, such as
the author, description, and keywords. It is located within the <head> section of
the HTML document.
[Link] is a form in HTML?
A form is a set of input fields and other elements to collect user data. Forms can
be used for various purposes, such as logging in, submitting feedback, or
purchasing.