HTML Questions
HTML Questions
TCA
3/2/2024
Q1. What is HTML?
HTML stands for Hypertext Markup Language. It is the standard markup language
used to create and design web pages. HTML provides the structure and layout of
content on a webpage by using a system of tags and attributes.
HTML tags are elements enclosed in angle brackets < >, and they are used
to define different parts of a webpage such as headings, paragraphs, links,
images, tables, and more. Attributes provide additional information about an
element and are added within the opening tag of an HTML element.
HTML is often used in conjunction with Cascading Style Sheets (CSS) and
JavaScript to create visually appealing and interactive web pages. While HTML
provides the structure and content of a webpage, CSS is used to style the
appearance of the elements, and JavaScript is used to add interactivity and
functionality to the webpage.
An HTML element is a fundamental HTML tags are markers that define the
building block of an HTML document. It beginning and end of an HTML element.
consists of an opening tag, content, and a They consist of angle brackets < >
closing tag (in most cases). The content is surrounding the name of the element. Tags
the information that appears between the are used to indicate the start and end of an
opening and closing tags, and it can include element, and they are essential for
text, other elements, or multimedia browsers to interpret and render HTML
content. Elements are used to define the documents correctly.
structure and semantics of a webpage.
Example of HTML tags:
Example of an HTML element:
• Opening tag: <p>
<p>This is a paragraph element. </p> • Closing tag: </p>
TCA 1
Q3. What are Attributes and how do you use them?
Example:
In this example, src and alt are attributes of the <img> element. The src
attribute specifies the URL of the image to be displayed, while the alt
attribute provides alternative text for the image, which is displayed if
the image cannot be loaded or by screen readers for accessibility.
Block Inline
A block-level element is drawn as a block Inline elements are drawn where they are
that stretches to fill the full width available defined and only take up space that is
to it i.e, the width of its container and will absolutely needed. The easiest way to
always start on a new line. understand how they work is to look at how
Elements that are block-level by text flows on a page.
default: <div>, <img>, <section>, <form>, Examples of elements that are inline by
<nav>. default: <span>, <b>, <strong>, <a>,
<input>.
To create a hyperlink in HTML, you use the <a> (anchor) element. The <a>
element defines a hyperlink, which is used to link from one webpage to another
or to link within the same webpage. Here's the basic syntax
TCA 2
Explanation of the attributes:
• href: This attribute specifies the URL (web address) of the page the link
goes to. It could also be a file path or an email address.
• Link text: This is the text that will be displayed as the clickable link.
Example:
In this example, when a user clicks on "Visit Example," the browser navigates to
https://www.example.com.
You can also create links that navigate to specific sections within the same
webpage using the href attribute combined with the id attribute of an element.
For example:
In this example, clicking on "Go to Section 2" will scroll the page to the <h2>
element with the id attribute set to "section2".
Q6. What are the HTML tags used to display the data in the tabular
form?
The list of HTML tags used to display data in the tabular form include:
Tag Decsription
<table> It defines a table
<tr> This tag defines a row in a table
<th> It defines a header cell in a table
<td> This is used to define a cell in a table
<caption> It defines the table caption
<colgroup> It specifies a group of one or more columns in a table for formatting
<col> This is used with <colgroup> element to specify column properties for
each column
<tbody> This tag is used to group the body content in a table.
<thead> It is used to group the header content in a table
<tfooter> It is used to group the footer content in a table
TCA 3
Q7. Name some common lists that are used when designing a
page.
There are many common lists used for design a page. You can choose any or a
combination of the following list types:
Semantic HTML refers to the use of HTML markup to convey the meaning or
purpose of the content within a web page, rather than just its appearance. It
involves using HTML elements that have descriptive names and reflect the
structure of the content they enclose.
In simpler terms, semantic HTML helps both search engines and web browsers
better understand the content of a webpage, which can improve accessibility,
search engine optimization (SEO), and overall code readability.
TCA 4
Q9. What is the difference between DIV and SPAN in HTML?
<div> and <span> are both HTML elements used for grouping and styling
content, but they serve different purposes and are typically used in different
contexts:
1. <div> (Division):
Example:
2. <span> (Inline):
Example:
TCA 5
Q10. What are the entities in HTML?
In HTML, entities are special characters that have a reserved meaning and
cannot be directly used in the text of a webpage. Instead, you must use their
entity name or entity number to display them correctly. Entities are primarily
used to represent characters that have special significance in HTML, such as
reserved characters like <, >, &, as well as characters with special formatting or
non-ASCII characters.
1. Reserved Characters:
3. Non-ASCII Characters:
Using entities ensures that your HTML code remains valid and that special
characters are displayed correctly in browsers. It's especially important when
dealing with characters that have special meanings in HTML or characters that
are not part of the ASCII character set.
TCA 6
Q11. Explain The Key Differences Between LocalStorage And
SessionStorage Objects.
2. Scope:
3. Persistence:
4. Use Cases:
TCA 7
• sessionStorage: Often used for storing temporary data that is only
needed for the duration of the page session, such as form data,
temporary authentication tokens, or session-specific state.
Semantic Elements:
HTML5 introduced native support for embedding audio and video content
directly into web pages without the need for third-party plugins like Flash. This is
achieved through the <audio> and <video> elements.
HTML5 introduced the <canvas> element, which provides a drawing surface for
dynamically generating graphics, charts, animations, and games using JavaScript.
HTML5 also added native support for Scalable Vector Graphics (SVG), allowing
vector-based graphics to be embedded directly into HTML documents.
Improved Forms:
HTML5 introduced several new input types and attributes for forms, including
email, URL, date, time, number, range, color, and more, making it easier to
create user-friendly and accessible forms.
HTML5 introduced the Application Cache (AppCache) and Local Storage API,
allowing web applications to work offline and store data locally within the user's
browser even when the internet connection is unavailable.
TCA 8
HTML5 also introduced the Web Storage API, which provides a more efficient
way to store data locally using key-value pairs through the localStorage and
sessionStorage objects.
Geolocation API:
HTML5 introduced the Geolocation API, which allows web applications to access
the user's geographic location using JavaScript, enabling location-based services
and personalized content.
Web Workers:
HTML5 introduced the concept of Web Workers, which allows scripts to run in
the background independently of the main browser thread, improving
performance and responsiveness, especially for tasks that are CPU-intensive or
time-consuming.
While not directly part of HTML5 specifications, the HTML5 era coincided with a
focus on responsive web design principles, making it easier to create websites
that adapt to different screen sizes and devices.
HTML5 also promotes accessibility through its semantic elements and attributes,
making it easier for developers to create web pages that are more accessible to
users with disabilities.
These are just a few of the key features of HTML5 that have had a significant
impact on web development and user experience. HTML5 continues to evolve,
with ongoing improvements and new features being introduced over time.
TCA 9