HTML
HTML
What is HTML
HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formatting
language which is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn
text into images, tables, links.
HTML is a language that is interpreted by the browser and it tells the browser what to display and how to display. HTML
only defines the structure of the data that will be rendered on the browser in a webpage; to make it visually appealing and
to make it functional, we will need to use CSS and Javascript respectively.
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.
Tags are the primary component of the HTML that defines how the content will be structured/ formatted, whereas
Attributes are used along with the HTML tags to define the characteristics of the element. For example, <p align=”
center”>Interview questions</p>, in this the ‘align’ is the attribute using which we will align the paragraph to show in
the center of the view.
HTML tags are like keywords which defines that how web browser will format and display the content. With the help of
tags, a web browser can distinguish between an HTML content and a simple content. HTML tags contain three main parts:
opening tag, content and closing tag. But some HTML tags are unclosed tags.
o content, and
o tags
When a web browser reads an HTML document, browser reads it from top to bottom and left to right. HTML tags are used
to create HTML documents and render their properties. Each HTML tags have different properties.
o All HTML tags must be enclosed within < > these brackets.
o Every tag in HTML performs different tasks. Each HTML tags have different properties
HTML elements which do not have closing tags or do not need to be closed are Void elements. For Example <br />,
<img />, <hr />, etc.
In HTML, a blank sequence of whitespace characters is treated as a single space character, Because the browser
collapses multiple spaces into a single space character and this helps a developer to indent lines of text without
worrying about multiple spaces and maintain readability and understandability of HTML codes.
In HTML some characters are reserved like ‘<’, ‘>’, ‘/’, etc. To use these characters in our webpage we need to use the character entities
called HTML Entities. Below are a few mapping between the reserved character and its respective entity character to be used.
HTML Lists are used to specify lists of information. All lists may contain one or more list elements. There are three different
types of HTML lists:
o Ordered list - The ordered list displays elements in numbered format. It is represented by <ol> tag.
o Unordered list - The unordered list displays elements in bulleted format. It is represented by <ul> tag.
o Definition list - The definition list displays elements in definition form like in dictionary. The <dl>, <dt> and <dd> tags
are used to define description list.
HTML Elements: These include the opening tag, content (if any), and closing tag. Example:
HTML Tags: These are just the symbols used to define elements. They are enclosed in angle brackets < >.
The class attribute is used to specify the class name for an HTML element. Multiple elements in HTML can have the same class
value. Also, it is mainly used to associate the styles written in the stylesheet with the HTML elements.
What is the difference between the ‘id’ attribute and the ‘class’ attribute of HTML elements?
Multiple elements in HTML can have the same class value, whereas a value of id attribute of one element cannot be associated
with another HTML element .
Strict Doctype: Enforces strict HTML rules, does not allow deprecated elements or attributes, ensuring clean and modern code.
Transitional Doctype: Allows both modern and some deprecated HTML elements/attributes, useful for transitioning from older
versions of HTML.
Frameset Doctype: Used for documents containing <frameset> elements instead of <body>, designed for websites using frames
(now obsolete in HTML5).