HTML 1
HTML 1
</body>
</html>
HTML Headings: These tags help us to give headings to the content of a webpage. These tags are mainly
written inside the body tag. HTML provides us with six heading tags from <h1> to <h6>. Every tag displays
the heading in a different style and font size.
Most HTML heading tag that we use :-
• Heading 1
• Heading 2
• Heading 3
Output
HTML Paragraph: These tags help us to write paragraph statements on a webpage. They start with the <p> tag and
ends with </p>.
HTML Break: – These tags are used for inserting a single line type break. It does not have any closing tag. In
HTML the break tag is written as <br>.
Example: This example illustrates the use of the <p> tag for writing a paragraph statement in HTML.
Output:
HTML elements have attributes that will provide additional information about that
particular element. It takes 2 parameters, ie, a name & a value which define the properties
of the element and are placed inside the element tag.
Points to remember for attributes:
• Attributes always come in name/value pairs like this: attribute_name=”value”.
• Attributes are always added to the start tag of an HTML element.
• Attribute values should always be enclosed in quotes. Double style quotes (“ ”) are the most
common, but single style quotes (‘ ’) are also allowed.
• In some rare situations, like when the attribute value itself contains quotes, it is necessary to
use single quotes: name=’John “ShotGun” Nelson’ and vice-versa.
• Syntax:
<element attribute_name="attribute_value">
HTML src Attribute: If we want to insert an image into a webpage, then we need to use the <img>
tag and the src attribute. We will need to specify the address of the image as the attribute’s value inside
the double quote.
Example: This example explains the HTML src Attributes to specify the source address of the file.
<html>
<head>
<title>src Attribute</title>
</head>
<body>
<img src=
"C:\Users\Saij srivastava\Dropbox\PC\Downloads\27_03_17_074809_College.jpg">
</body>
</html>
Input:
<html>
<head>
</head>
<body>
<img src=
"C:\Users\Saij srivastava\Dropbox\PC\Downloads\27_03_17_074809_College.jpg"
</body>
</html> Output:
HTML href Attribute: This attribute is used to specify a link to any address. This attribute is used along
with the <a> tag. The link put inside the href attribute gets linked to the text displayed inside the<a> tag. On
clicking on the text we will be redirected to the link. By default, the link gets opened in the same tag but by
using the target attribute and setting its value to “_blank”, we will be redirected to another tab or another
window based on the browser’s configuration.
HTML style Attribute: This attribute is used to provide various CSS effects to the HTML elements such as
increasing font-size, changing font-family, coloring, etc.
Example: This example explains the HTML style Attributes to specify the style properties for the HTML
element.
Input
Output
Input
Output
Making text Bold or Strong: We can make the text bold using the <b> tag. The tag uses both opening and
closing tags. The text that needs to be made bold must be within <b> and </b> tag. We can also use
the <strong> tag to make the text strong, with added semantic importance. It also opens with <strong> and ends
with </strong> tag.
Output
Input
Making text Italic or emphasize: The <i> tag is used to italicise the text. It opens with <i> and ends
with </i> tag. The <em> tag is used to emphasize the text, with added semantic importance. It opens
with <em> and ends with </em> tag.
Output
Input
HTML Display
You cannot be sure how HTML will be displayed.
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the display by adding extra spaces or extra lines in your HTML code.
Input
Output
HTML Horizontal Rules
The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule
Output
Input
The Poem Problem
Input
Output
Solution - The HTML <pre> Element
The HTML <pre> element defines preformatted text
Input
Output
HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font, size, and more
Input Output
<tagname style="property:value;">
Background Color
Output
Input
Output
Input
Text Color
The CSS color property defines the text color for an HTML element
Input Output
Fonts
Output
Input
Text Size
Output
Input
Text Alignment
Input
Output
HTML Formatting Element
Tag Description
<b> Defines bold text
<em> Defines emphasized text
<i> Defines a part of text in an alternate voice or mood
<small> Defines smaller text
<strong> Defines important text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<mark> Defines marked/highlighted text