HTML Basics: Structure and Function
HTML Basics: Structure and Function
HTML BASICS
HTML is an acronym which stands for Hyper Text Markup Language which is used for
creating web pages and web applications. Let's see what is meant by Hypertext Markup
Language, and Web page.
Hyper Text: HyperText simply means "Text within Text." A text has a link within it, is a
hypertext. Whenever you click on a link which brings you to a new webpage, you have
clicked on 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. With the help of HTML only, we can create static web
pages.
Hence, HTML is a markup language which is used for creating attractive web pages with
the help of styling, and which looks in a nice format on a web browser. An HTML
document is made of many HTML tags and each HTML tag contains different content.
WWW
World Wide Web, which is also known as a Web, is a collection of websites or web pages
stored in web servers and connected to local computers through the internet. These
websites contain text pages, digital images, audios, videos, etc. Users can access the
content of these sites from any part of the world over the internet using their devices such
as computers, laptops, cell phones, etc. The WWW, along with internet, enables the
retrieval and display of text and media to your device.
The building blocks of the Web are web pages which are formatted in HTML and
connected by links called "hypertext" or hyperlinks and accessed by HTTP. These links
are electronic connections that link related pieces of information so that users can access
the desired information quickly. Hypertext offers the advantage to select a word or phrase
from text and thus to access other pages that provide additional information related to that
word or phrase.
A web page is given an online address called a Uniform Resource Locator (URL). A
particular collection of web pages that belong to a specific URL is called a website,
e.g., [Link], [Link], etc. So, the World Wide Web is like a huge
electronic book whose pages are stored on multiple servers across the world.
Small websites store all of their WebPages on a single server, but big websites or
organizations place their WebPages on different servers in different countries so that when
users of a country search their site they could get the information quickly from the nearest
server.
So, the web provides a communication platform for users to retrieve and exchange
information over the internet. Unlike a book, where we move from one page to another in
a sequence, on World Wide Web we follow a web of hypertext links to visit a web page
and from that web page to move to other web pages. You need a browser, which is installed
on your computer, to access the Web.
W3C
W3C stands for World Wide Web Consortium. It is basically the main international
establishment for the WWW(World Wide Web). The main motive behind the World
Wide Web Consortium is to lead the web to its full potential and to ensure regular
development of the web. It serves the purpose of developing various protocols in order to
ensure the growth of the web. It consists of organizations that provide full time working
for staff in order to ensure the development of the web. Currently, the W3C is being led
by Tim Berners-Lee and has a staff of 443 members. The main headquarters of W3C is
located in Cambridge, Massachusetts, United States.
Characteristics of W3C
It is responsible for creating and publishing web standards.
It also ensures the growth and development of web.
It also develops the standards for web scripting, web applications and other dynamic
contents.
It is an organization which helps in the promotion of interoperability by the
promotion and designing of open protocols.
W3C uses the principles of modularity, simplicity and extensibility while designing
web protocols
Web Publishing
Web publishing is the process of publishing original content on the Internet.
The process includes building and uploading websites, updating the associated
webpages, and posting content to these webpages online. Web publishing comprises of
personal, business, and community websites in addition to e-books and blogs.
The content meant for web publishing can include text, videos, digital images, artwork,
and other forms of media.
Publishers must possess a web server, a web publishing software, and an Internet
connection to carry out web publishing.
Web publishing is also known as online publishing.
Components of web Publishing
Web publishing involves several components that work together to make content
available on the internet. Here are a few key components:
Content: The content is the information or media that is being published on the website.
This can include text, images, videos, audio, and other types of multimedia.
Web server: A web server is a computer that runs software that allows it to host and
serve web pages to users. It stores all the files and data of the website.
Domain name: A domain name is the address that users type into their web browser to
access a website (e.g. [Link])
HTML and CSS: HTML and CSS are the languages used to create the structure and
design of a website.
Web design: The design of a website is important for user experience and accessibility.
Optimization: Optimizing a website for search engines and user experience is
important for better visibility on the web.
Maintenance: Regular maintenance and updates are required to keep the website
running smoothly and to ensure that the content remains relevant.
Security: Website security measures should be implemented to protect against hacking
and other security threats.
Analytics: Website analytics should be used to track user behavior and website
performance, which can help inform future updates and improvements.
Introduction to Html
HTML is an acronym which stands for Hyper Text Markup Language which is used for
creating web pages and web applications. Let's see what is meant by Hypertext Markup
Language, and Web page.
Hyper Text: HyperText simply means "Text within Text." A text has a link within it, is a
hypertext. Whenever you click on a link which brings you to a new webpage, you have
clicked on a hypertext. HyperText is a way to link two or more web pages (HTML
documents) with each other.
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. With the help of HTML only, we can create
static web pages.
Hence, HTML is a markup language which is used for creating attractive web pages with
the help of styling, and which looks in a nice format on a web browser. An HTML
document is made of many HTML tags and each HTML tag contains different content.
Html Document structure
Html used predefined tags and attributes to tell the browser how to display content, means
in which format, style, font size, and images to display. Html is a case insensitive language.
Case insensitive means there is no difference in upper case and lower case ( capital and
small letters) both treated as the same, for r example ‘D’ and ‘d’ both are the same here.
There are generally two types of tags in HTML:
Paired Tags: These tags come in pairs. That is they have both opening(< >) and closing(</
>) tags.
Empty Tags: These tags do not require to be closed.
Below is an example of a (<b>) tag in HTML, which tells the browser to bold the text
inside it.
Below is an example of a (<b>) tag in HTML, which tells the browser to bold the text
inside it.
Tags and attributes: Tags are individuals of html structure, we have to open and close
any tag with a forward slash like this <h1> </h1>. There are some variations with the tag
some of them are self-closing tag which isn’t required to close and some are empty tag
where we can add any attributes in it. Attributes are additional properties of html tags that
define the property of any html tags. i.e. width, height, controls, loops, input, and autoplay.
These attributes also help us to store information in meta tags by using name, content, and
type attributes. Html documents structured mentioned below:
HEAD: This contains the information about the HTML document. For Example, the Title
of the page, version of HTML, Meta Data, etc.
BODY: This contains everything you want to display on the Web Page.
Where, <b> is the starting tag and </b> is the ending tag.
HTML Attributes: It is used to define the character of an HTML element. It
always placed in the opening tag of an element. It generally provides additional
styling (attribute) to the element.
Physical and Logical tags are used in HTML for better visibility and understanding of
the text by the user on the web page. However, both tags differ from each other as
suggested by their names.
Logical Tags :
Logical Tags are used in HTML to display the text according to the logical
styles. Following are the Logical tags commonly used in HTML.
Logical Tags
Tag Description
Physical Tags
Physical Tags are used in HTML to provide actual physical formatting to the text.
Following are the Physical tags commonly used in HTML.
Physical Tags
Tag Description
Title Tag
The title tag <title> specifies the HTML page title, which is shown in the browser’s title
bar.
Body Tag
The body tag <body> is where you insert your web page’s content.
Paragraph Tag
A paragraph tag <p> is used to define a paragraph on a web page.
Heading Tag
The HTML heading tag is used to define the heading of the HTML document. The <h1>
tag defines the most important tag, and <h6> defines the least.
HTML <a> Tag
The <a> tag (anchor tag) in HTML is used to create a hyperlink on the webpage. This
hyperlink is used to link the webpage to other web pages or some section of the same web
page. It’s either used to provide an absolute reference or a relative reference as its “href”
value.
Syntax:
<!DOCTYPE html>
<html>
<body>
<h2>
Welcome to GeeksforGeeks
HTML Tutorial
</h2>
<a href=
" [Link]
Sandip University Homepage
</a>
</body>
</html>
Image tag
HTML img tag is used to display image on the web page. HTML img tag is an empty tag
that contains attributes only, closing tags are not used in HTML image element.
Output:
1) src
It is a necessary attribute that describes the source or path of the image. It instructs the
browser where to look for the image on the server.
2) alt
The alt attribute defines an alternate text for the image, if it can't be displayed. The value
of the alt attribute describe the image in words. The alt attribute is considered good for
SEO prospective.
3) width
It is an optional attribute which is used to specify the width to display the image. It is not
recommended now. You should apply CSS in place of width attribute.
4) height
It h3 the height of the image. The HTML height attribute also supports iframe, image and
object elements. It is not recommended now. You should apply CSS in place of height
attribute.
Use of height and width attribute with img tag
You have learnt about how to insert an image in your web page, now if we want to give
some height and width to display image according to our requirement, then we can set it
with height and width attributes of image.
Example:
<img src="[Link]" height="180" width="300" alt="animal image">
<!DOCTYPE html>
<html>
<head>
<title>Image tag</title>
</head>
<body>
<h2>HTML image example with height and width</h2>
<img src="[Link] height="180"
width="300" alt="animal image">
</body>
</html>
Example:
<a href="[Link] src="[Link]"
height="100" width="100"></a>
An HTML element is defined by a starting tag. If the element contains other content, it
ends with a closing tag, where the element name is preceded by a forward slash as shown
below with few tags −
Text Elements
HTML also defines special elements for defining text with a special meaning.
The HTML <b> element defines bold text, without any extra importance.
Example
<b>This text is bold</b>
The HTML <strong> element defines strong text, with added semantic "strong"
importance.
Example
<strong>This text is strong</strong>
The HTML <i> element defines italic text, without any extra importance.
Example
<i>This text is italic</i>
The HTML <em> element defines emphasized text, with added semantic importance.
Example
<em>This text is emphasized</em>
Example
<h2>HTML <small>Small</small> Formatting</h2>
Example
<h2>HTML <mark>Marked</mark> Formatting</h2>
Example
<p>My favorite color is <del>blue</del> red.</p>
Example
<p>My favorite <ins>color</ins> is red.</p>
Example
<p>This is <sub>subscripted</sub> text.</p>
Example
<p>this is <sup>superscripted</sup> text. </p>
Background color
By default, your webpage background is white in color. You may not like it, but no
worries. HTML provides you following two good ways to decorate your webpage
background.
<body bgcolor="color_name|hex_number|rgb_number">
Example:
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Colors</title>
</head>
<body>
<!-- Format 1 - Use color name -->
<table bgcolor = "yellow" width = "100%">
<tr>
<td>
This background is yellow
</td>
</tr>
</table>
</html>
OUTPUT:
Syntax:
<!DOCTYPE html>
<html>
<body>
<h2>
Welcome to Sandip University
HTML Tutorial
</h2>
<a href=
" [Link]
Sandip University Homepage
</a>
</body>
</html>
HTML Links - Use an Image as a Link
To use an image as a link, just put the <img> tag inside the <a> tag:
Example
<a href="[Link]">
<img src="[Link]" alt="HTML tutorial" style="width:42px;height:42px;">
</a>
Output:
Image Maps
With HTML image maps, you can create clickable areas on an image.
The HTML <map> tag defines an image map. An image map is an image with clickable
areas. The areas are defined with one or more <area> tags.
[Link]
Module-2
HTML Table
HTML table tag is used to display data in tabular form (row * column). There can
be many columns in a row.
We can create a table to display data in tabular form, using <table> element, with
the help of <tr> , <td>, and <th> elements.
In Each table, table row is defined by <tr> tag, table header is defined by <th>, and
table data is defined by <td> tags.
HTML tables are used to manage the layout of the page e.g. header section,
navigation bar, body content, footer section etc. But it is recommended to use div
tag over table to manage the layout of the page .
Tag Description
<table> It defines a table.
<col> It is used with <colgroup> element to specify column properties for each column.
<!DOCTYPE>
<html>
<body>
<table>
<tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
<tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
<tr><td>James</td><td>William</td><td>80</td></tr>
<tr><td>Swa </td><td>Sironi</td><td>82</td></tr>
<tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
</table>
</body>
</html>
TML Forms are used to send data across the web, like login, signup, search etc. Forms are
often used as contact form to convert information input by a user into leads. Forms
includes many inputs controls like text, password, file, radio, checkbox etc.
The elements used in HTML form are form tag as parent, input, textarea,, select, button
and label.
HTML Form Tag
Form Tag defines the form and within this tag, there is action attribute which tells the form
where its contents will be sent when it is submitted.
An HTML form can have input elements, checkbox, radio buttons, submit button and
more.A form can also contain select dropdown, textarea, fieldset, legend, and label
elements.
method get or http get method submit form data but is visible in url.
post post includes data in body. more secure as data is not visible to user in
url
action path the backend file collecting form data
Input Element
The most important form element is the input element. The input element is used to get
user information. An input element can be of type text, password, checkbox, radio
button, submit button and more.
type text, password, file, radio, type defines type of input control.
checkbox, button, submit, and
reset
<label for="age">Age:</label>
<input type="text" id="age" maxlength="3">
</form>
Size
Size attribute is used to set the size of input or textarea. The default size is 20. To
increase or decrease input size, change value of size.
size attribute example
Age:
<label>Age: <input type="text" size="3"> </label>
Pincode:
<label>Pincode: <input type="text" size="6" maxlength="6"></label>
Input type Password
The input type password is used to write passwords. The password value is written in
encrypt form. i.e. a user cannot see, copy or cut password data from input type password.
Input type password example
Password:
<form>
<label for="pwd">Password:</label>
<input type="password" id="pwd" >
</form>
Input type File
Input type file let user to choose file from his system. This can be used to upload a
picture, upload resume, upload a video or audio etc.
Default value of input type file is "No file chosen". Once the file is uploaded, the file
name replace this text followed by extension.
<form>
<label for="resume">Resume:</label>
<input type="file" id="resume">
</form>
Input type file with multiple
<form>
<label for="pics">Upload pictures : </label>
<input type="file" id="pics" multiple>
</form>
Radio Buttons
Radio Buttons are used to choose a single element among a group.
To allow window to choose a single radio, use name attribute with same value on both
radio inputs.
Radio Button For Multiple Questions
Checkbox
Checkbox are used to select multiple selections unlike radio button. They can be checked
and unchecked. We can use checkbox for hobbies, interests, terms & conditions, etc.
Form Checkbox
Assignment -2
1. Explain w3C with its characteristics. (7/8)
2. Explain HTML with structure. (7/8)
3. Describe the components of Web Publishing. (7/8)
4. Explain HTML Tags, Logical and Physical Tags. (7/8)
5. Explain the image tag in html with syntax. (7/8)
6. Write html code to generate following output. (7/8)
• Coffee
• Tea
o Black Tea
o Green Tea
• Milk
7. Give Syntax with example for any 6 tags used for formatting text fonts. (7/8)
8. Explain the HTML Table tag with its attributes. (7/8)
9. Give the syntax for Label in Forms. (2)
[Link] Radio Button (2)
[Link] the term Hyper Text. (2)
[Link] the types of List Tags. (2)