0% found this document useful (0 votes)
2 views

background-theory-of-html

The document provides an overview of HTML, including its basic structure, types of lists, hyperlinks, and various tags such as <table>, <a>, <img>, <form>, and <frameset>. It explains the purpose of each tag, their attributes, and examples of how to use them. Additionally, it covers concepts like web pages, websites, URLs, search engines, CMS, web servers, and common protocols used in web development.

Uploaded by

Nirvik K.C.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

background-theory-of-html

The document provides an overview of HTML, including its basic structure, types of lists, hyperlinks, and various tags such as <table>, <a>, <img>, <form>, and <frameset>. It explains the purpose of each tag, their attributes, and examples of how to use them. Additionally, it covers concepts like web pages, websites, URLs, search engines, CMS, web servers, and common protocols used in web development.

Uploaded by

Nirvik K.C.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

1) What is HTML? Write and explain the basic structure of HTML.

=HTML stands for Hyper Text Markup Language. It is a markup language used for
creating web pages and web applications. HTML uses a set of markup tags to
define the structure and content of a web page. The basic structure of an HTML
document consists of the following parts:
<!DOCTYPE html> declaration: It specifies the version of HTML used in the
document.
<html> element: It is the root element of an HTML document.
<head> element: It contains metadata about the document, such as the title and
links to external resources.
<body> element: It contains the main content of the document, such as text,
images, and other elements.

2. What is listing in HTML? Explain different types of listing used in HTML.


=In HTML, a list is a group of items that are displayed in a specific order or
hierarchy. Lists are used to organize content on web pages, making it easier for
users to scan and read.
There are three types of lists in HTML: ordered lists, unordered lists, and definition
lists.
Ordered lists: An ordered list is a list where each item is numbered. To create an
ordered list, you use the <ol> tag. Within the <ol> tag, you use the <li> tag to
create each list item.

Unordered lists: An unordered list is a list where each item is bulleted or marked
with a symbol. To create an unordered list, you use the <ul> tag. Within the <ul>
tag, you use the <li> tag to create each list item.
3. What is hyperlink? Explain different types of hyperlinks used in HTML.
=A hyperlink is a clickable link that takes the user to another web page or a
specific location on the same page. There are several types of hyperlinks in
HTML:

Standard hyperlink: It is a link to another web page. It is created using the <a> tag
with the href attribute.
Email link: It is a link that opens the default email client with a pre-filled email
address. It is created using the <a> tag with the href attribute starting with
"mailto:"

Image link: It is a link that is represented by an image. It is created using the <a>
tag wrapped around the <img> tag.

Anchor link: It is a link that takes the user to a specific location on the same page.
It is created using the <a> tag with the href attribute starting with "#".

4. Write the use of <table> tag and explain different attributes of <table> tag
with examples.
=The <table> tag in HTML is used to create tables on web pages. Tables are used
to organize and present data in a structured way, making it easier for users to
understand and compare information. The <table> tag is used to define the table,
and the <tr>, <th>, and <td> tags are used to define the rows, headers, and data
cells of the table.
Here are some common attributes of the <table> tag and how they are used :
1.border: This attribute specifies the width of the border around the table. For
example:
<table border="1">
...
</table>

2.cellpadding: This attribute specifies the space between the border of each cell
and its content. For example:
<table cellpadding="5">
...</table>
3.cellspacing: This attribute specifies the space between cells. For example:
<table cellspacing="10">
...
</table>

4.width: This attribute specifies the width of the table. For example:
<table width="500">
...
</table>

5.align: This attribute specifies the horizontal alignment of the table within its
container. For example:
<table align="center">
...
</table>

6.bgcolor: This attribute specifies the background color of the table. For example:
<table bgcolor="#f0f0f0">
...
</table>

5. Write the use of <a> tag and explain different attributes of <a> tag
withexamples.
=The <a> tag in HTML is used to create links to other web pages, files, or
resources. The tag is an inline element and can be used to wrap around text,
images, or other HTML elements to create clickable links.
Here are some common attributes of the <a> tag and how they are used:
1. href: This attribute specifies the destination URL or the file that the link
should open. For example:
<a href="https://www.example.com">Click here to visit Example.com</a>

2. target: This attribute specifies where the linked page should open. The target
attribute can take different values such as "_blank" to open the linked page
in a new window, or "_self" to open the page in the same window. For
example:

<a href="https://www.example.com" target="_blank">Visit Example.com in


a new window</a>

3. title: This attribute specifies a tooltip that is displayed when the user hovers
over the link. For example:

<a href="https://www.example.com" title="Visit


Example.com">Example.com</a>

4. download: This attribute specifies that the linked resource should be


downloaded instead of displayed in the browser. For example:

<a href="files/document.pdf" download>Download the PDF</a>

5. rel: This attribute specifies the relationship between the current page and the
linked page. For example, the "nofollow" value indicates that search engines
should not follow the link. For example:

<a href="https://www.example.com" rel="nofollow">Example.com</a>

6. tabindex: This attribute specifies the tab order of the link when the user
navigates using the keyboard. For example:

<a href="https://www.example.com" tabindex="2">Example.com</a>


6. Write the use of <img>tag and explain different attributes of <img> tag
withexamples.
=The <img> tag in HTML is used to embed images into web pages. The tag is an
inline element and is self-closing, which means it does not require a closing tag.
The <img> tag has several attributes that can be used to customize the appearance
and behavior of the image.
Here are some common attributes of the <img> tag and how they are used:

1.src: This attribute specifies the URL of the image file. For example:
<imgsrc="image.jpg">

2.alt: This attribute specifies the alternate text that is displayed if the image cannot
be loaded or if the user is using a screen reader. For example:
<imgsrc="image.jpg" alt="A beautiful sunset">

3.width: This attribute specifies the width of the image in pixels or as a percentage
of the container width. For example:
<imgsrc="image.jpg" width="500">

4.height: This attribute specifies the height of the image in pixels or as a percentage
of the container height. For example:
<imgsrc="image.jpg" height="300">

5. title: This attribute specifies a tooltip that is displayed when the user hovers over
the image. For example:
<imgsrc="image.jpg" title="A beautiful sunset">

6. alt: This attribute specifies the alternate text that is displayed if the image cannot
be loaded or if the user is using a screen reader. For example:
<imgsrc="image.jpg" alt="A beautiful sunset">

7.style: This attribute allows you to add CSS styles to the image, such as a border or
a margin. For example: css
<imgsrc="image.jpg" style="border: 1px solid black;">
7. What is CSS? Write different methods of using CSS in HTML.
=CSS stands for Cascading Style Sheets. It is a style sheet language used to describe the
presentation of a web page written in HTML or XML. CSS separates the presentation of
a web page from its content, making it easier to maintain and update the appearance of a
website.
There are three ways to use CSS in HTML:

1.External CSS: In this method, the CSS code is stored in a separate file with a .css
extension and linked to the HTML file using the <link> tag in the <head> section of the
HTML document. Here is an example: HTML file:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Hello, World!</h1>
<p>Welcome to my website.</p>
</body>
</html>

2.Internal CSS: In this method, the CSS code is written within the <style> tags in the
<head> section of the HTML document. Here is an example:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}

h1 {
color: #0066cc;
}

p{
color: #333;
}
</style>
</head>
<body>
<h1>Hello, World!</h1>
<p>Welcome to my website.</p>
</body>
</html>

3. Inline CSS: In this method, the CSS code is written directly in the HTML element
using the style attribute. Here is an example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 style="color: #0066cc;">Hello, World!</h1>
<p style="color: #333;">Welcome to my website.</p>
</body>
</html>

8. What is <form> tag? Explain different tags used within <form>tag in with
examples.
=The <form> tag is an HTML element used to create a form on a web page that allows
users to input data and send it to a server for processing. The <form> tag encloses a set of
form elements that can be used to collect user input and transmit it to a server using
HTTP requests.
Here are some commonly used tags within the <form> tag

1.: <input> tag: The <input> tag is used to create various types of form controls such as
text boxes, radio buttons, checkboxes, buttons, and more. Here is an example:
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<input type="submit" value="Submit">
</form>
2.<label> tag: The <label> tag is used to associate a label with a form element such as
<input>, <select>, or <textarea>. The label provides a description of the form element for
screen readers and other assistive technologies. Here is an example:
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<input type="submit" value="Submit">
</form>

3. <select> tag: The <select> tag is used to create a drop-down list of options for users to
choose from. Here is an example:
<form>
<label for="fruit">Select your favorite fruit:</label>
<select id="fruit" name="fruit">
<option value="apple">Apple</option>
<option value="banana">Banana</option>
<option value="orange">Orange</option>
</select>
<input type="submit" value="Submit">
</form>

4.<textarea> tag: The <textarea> tag is used to create a multi-line text input field. Here is
an example:
<form>
<label for="message">Enter your message:</label>
<textarea id="message" name="message"></textarea>
<input type="submit" value="Submit">
</form>

5.<button> tag: The <button> tag is used to create a clickable button that can trigger an
action, such as submitting a form or resetting the form fields. Here is an example:
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>

9. What is the use of <frameset> tag and <frameset>tag in HTML? Explain


withexamples.
=The <frameset> tag is an HTML element that defines a set of frames in a web page. It
allows you to divide the web page into several independent frames and display different
web pages within each frame. The <frameset> tag is used in conjunction with the
<frame> tag, which defines the content that is displayed in each frame.
Here is an example of how to use the <frameset> tag and the <frame> tag:
<!DOCTYPE html>
<html>
<head>
<title>Example Frameset</title>
</head>
<frameset rows="20%,80%">
<frame src="header.html" name="header">
<frameset cols="30%,70%">
<frame src="menu.html" name="menu">
<frame src="content.html" name="content">
</frameset>
</frameset>
</html>
10. Write short notes on:
a) Web page: A web page is a document that is displayed in a web browser when a user
visits a website. It contains a combination of text, images, and other multimedia elements
that are presented in a structured layout using HTML and CSS.
b) Web site: A website is a collection of web pages that are related to each other and are
typically hosted on the same domain or subdomain. Websites can be used for a variety of
purposes, such as sharing information, selling products or services, or providing
entertainment.
c) URL: A URL (Uniform Resource Locator) is the address used to access a web page or
other online resource. It typically consists of a protocol (such as HTTP or HTTPS), a
domain name, and a path to the specific resource.
d) Search Engine: A search engine is a software tool that allows users to search for web
pages or other online content based on specific keywords or phrases. Examples of search
engines include Google, Bing, and Yahoo.
e) CMS (Content Management System): A CMS is a software tool that allows users to
create, manage, and publish digital content, typically for websites. Examples of popular
CMS platforms include WordPress, Drupal, and Joomla.
f) Web Server: A web server is a computer program that is responsible for serving web
pages and other online content to users who request it. When a user requests a web page,
the web server retrieves the necessary files and sends them to the user's web browser.
g) Protocols (TCP/IP, HTTP, HTTPS, FTP, SMTP, POP): Protocols are sets of rules and
standards that govern how data is transmitted over a network. Some common protocols
used in web development include:
-TCP/IP: The TCP/IP protocol suite is used for communication between devices on the
internet.
-HTTP: The HTTP protocol is used for transferring data over the web. It is the protocol
used for most web pages and web applications.
-HTTPS: HTTPS is a secure version of HTTP that uses encryption to protect data
transmitted over the web.
-FTP: FTP (File Transfer Protocol) is used for transferring files between computers over
a network. SMTP: SMTP (Simple Mail Transfer Protocol) is used for sending email
messages between servers.
- POP: POP (Post Office Protocol) is used for retrieving email messages from a server

You might also like