Chapter 3
Basic elements of HTML(Notes)
HTML, or HyperText Markup Language, was invented by Tim Berners-
Lee in 1991 while working at CERN to facilitate information sharing
among scientists.
HTML is based on SGML(Standard General Markup Language) , which in
turn was derived from GML(General Markup Language) . Essentially,
GML laid the groundwork for structured document representation, while
HTML adopted these principles to create the language of the web.
HTML stands for Hyper Text Markup Language
HTML is the standard markup language for creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
Tag or Element
Tags: Tags are the building blocks of HTML and are used to define the
structure and semantics of the content. They are enclosed in angle
brackets (<>) and appear as opening and closing pairs.
For example, <HTML>, <Head>, <title> etc.
Attribute
Attributes: Attributes are used to provide additional information or modify
the behavior of HTML elements defined by tags. They are placed within the
opening tag of an HTML element and consist of a name and a value.
An attribute is a property name that adds more functionality to the content enclosed
within a tag. The attribute is written next to the tag name.
Value
Value refers to the property value which can be applied to the attribute of an HTML
element. Value must be provided next to attribute with equals to (=) sign. Then
written into double quotes.
HTML Tag structure
An HTML tag written in the proper manner with its attributes and values is called an HTML
tag structure.
The <head> tag
It defines the head section of the HTML web page. It consists of the header information such
as the title of the webpage, scripts like javascript or VBScript, styles used in the document,
and description tags. This tag has no attribute.
The <title> tag
It displays the title of your webpage on the title bar. It plays an important role to crawl your
webpage by Google or any other search engine. The title must be descriptive, unique, and
short for each document.
<html>
<head>
<title> HTML basic tags </title>
</head>
<body>
Main content of the page goes here.
</body>
</html>
The <body> tag
It is the main area where the user’s content will be displayed on the web page. Each and
every content like text, lists, tables, images, audio, video, frames, etc. will be inserted
between <html> and </html>. This element has the following attributes:
Background
The background attribute is used to apply or change the background image of your
webpage.
Ex-
<html>
<head>
</head>
<body background="back-img.jpg">
Your contents goes here.
</html>
When you are using an image as background following points should be taken care
of:
1. The image must be copied into the same folder where you want to save your
HTML file.
Write an image name with an extension. Check the properties of the image to
view the extension.
2. All browsers did not support displaying a background image with this
attribute.
3. You must ensure that the text colour and background image colour should be
used in such a way that the user can read the text properly.
4. The image extension must be provided with your file name.
bgcolor
This attribute is also related to the background color of the webpage. The value can
be any color name or color code.
html>
<head>
<title>Background Color Demo</title>
</head>
<body bgcolor="blue">
Your contents goes here.
</html>
Text
This attribute changes the color of text written into the webpage. The text which is not a part
of any other element or formatting styles can be displayed with the given color.
<html>
<head>
<title>Background Color Demo</title>
</head>
<body bgcolor="blue" text="white">
Your contents goes here.
</html>