HTML Notes
HTML Notes
HTML stands for Hyper Text Markup Language and is the language of the internet. It
is the standard text formatting language used for creating and displaying pages on
the Internet
HTML documents are made up of the elements and the tags that format it for proper
display on pages.
We use HTML tags for placing the elements in the proper and appropriate format.
Tags use the symbols <, and > to set them apart from the HTML content.
The HTML tags need not be closed always. For example, in the case of images, the
closing tags are not required as <img> tag.
Attributes are the properties that can be added to an HTML tag. These attributes
change the way the tag behaves or is displayed. For example, a <img> tag has a src
attribute, which you use to add the source from which the image should be
displayed.
We add attributes right after the name of the HTML tag, inside the brackets. We can
only add the attributes to opening or self-closing tags, but never be in closing tags.
Marquee is used for scrolling text on a web page. It scrolls the image or text up,
down, left, or right automatically. To apply for a marquee, you have to use
</marquee> tags.
5. How do you separate a section of texts in HTML?
<br> tag – It is used to separate the line of text. It breaks the current line and shifts
the flow of the text to a new line.
Ordered list–The ordered list uses <ol> tag and displays elements in a numbered
format.
Unordered list–The unordered list uses <ul> tag and displays elements in a bulleted
format.
Definition list–The definition list uses <dl>, <dt>, <dd> tags and displays elements in
definition form like in a dictionary.
An unordered list uses <ul> </ul> tags and each element of the list is written between
<li> </li> tags. The list items are displayed as bullets rather than numbers.
An ordered list uses <ol> </ol> tags and each element of the list is written between
<li> </li> tags. The list items are displayed as numbers rather than bullet points.
<!DOCTYPE html>
<html>
<body>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
The HTML <table> tag is used to display data in a tabular format. It is also used to
manage the layout of the page, for example, header section, navigation bar, body
content, footer section. Given below are the list of HTML tags used for displaying a
table in an HTML webpage:
Tag Description
We use the anchor tag <a> to create a hyperlink in HTML that links one page to
another page. The hyperlink can be added to images too.
We can use the built-in Button tag in HTML to add buttons to an HTML web page.
<!DOCTYPE html>
<html>
<body>
</body>
</html>
There are six types of heading tags in HTML which are defined with the <h1> to <h6>
tags. Each type of heading tag displays a different text size from another. <h1> is the
largest heading tag and <h6> is the smallest. For example:
<!DOCTYPE html>
<html>
<body>
</html>
You can insert an image in the HTML webpage by using the following code:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
You can insert a hyperlink in the HTML webpage by using the following code:
<!DOCTYPE html>
<html>
<body>
</html>
You can add colour to the text in HTML by using the following code:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Inline CSS: It is used when less amount of styling is needed or in cases where only a
single element has to be styled. To use inline styles add the style attribute in the
relevant tag.
External Style Sheet: This is used when the style is applied to many elements or
HTML pages. Each page must link to the style sheet using the <link> tag:
<head>
</head>
Internal Style Sheet: It is used when a single HTML document has a unique style and
several elements need to be styled to follow the format. Internal styles sheet is
added in the head section of an HTML page, by using the <style> tag:
<head>
<style type="text/css">
hr { color: sienna; }
p{ margin-left: 20px; }
</style>
</head>
The ‘class' attribute in HTML defines a class for an HTML element. It can be used to apply a
specific style to a group of elements on a web page.
18. What is the difference between the ‘id' and ‘class' attributes of HTML elements?
The ‘id' attribute defines a unique identifier for an HTML element, while the ‘class' attribute
defines a class for a group of elements. An ‘id' can only be used once on a page, while a
‘class' can be used multiple times.
HTML5 is the latest version of HTML and includes new features and improvements over
previous versions. Some key differences between HTML and HTML5 include support for
multimedia elements (such as video and audio), improved semantics, and better support for
mobile devices.
The <head> tag defines information about the web page that is not displayed on the page
itself, such as its title, keywords, and other metadata. It is located between the <html> and
<body> tags and is usually the first element in the document.
The <meta> tag provides additional information about the web page, such as the author,
description, and keywords. It is located within the <head> section of the HTML document.
A form is a set of input fields and other elements to collect user data. Forms can be used for
various purposes, such as logging in, submitting feedback, or purchasing.