Sunteți pe pagina 1din 13

HTML Tags

An HTML file must have some essential tags so


that web browser can differentiate between a
simple text and HTML text. You can use as many
tags you want as per your code requirement.

10
5 • All HTML tags must enclosed within < > these
brackets.
• Every tag in HTML perform different tasks.
• If you have used an open tag <tag>, then you
must use a close tag </tag> (except some tags)
Syntax

<tag> content </tag>

ETL LABS PVT LTD – PHP 136


Heading Tags
Headings are defined with the <h1> to
<h6> tags.

<h1> defines the most important 11


5
heading. <h6> defines the least
important heading.

ETL LABS PVT LTD – PHP 137


Paragraph Tags
12
5 The HTML <p> element defines a paragraph

ETL LABS PVT LTD – PHP 138


Style Attribute

Set Background Color


The background-color property defines
the background-color for an HTML
element. 13
5

This example sets the background color


for a page to powderblue

ETL LABS PVT LTD – PHP 139


Set Text Color
14
5 The color property defines the text color for an
HTML element

ETL LABS PVT LTD – PHP 140


Set Text Size
The font-size property defines the text
size for an HTML element 15
5

ETL LABS PVT LTD – PHP 141


Set Text Alignment
The text-align property defines the horizontal text
16
5 alignment for an HTML element

ETL LABS PVT LTD – PHP 142


Formatting Elements
HTML also defines special elements for
defining text with a special meaning.

HTML uses elements like <b> and <i> 17


5
for formatting output, like bold or italic
text.

Formatting elements were designed to


display special types of text
Example

<b>This text is bold</b>

ETL LABS PVT LTD – PHP 143


<p>
WWF's goal is to: Quotation Tag
<q> The HTML <q> element defines a short quotation.
Build a future where
18
5
people live in
Browsers usually insert quotation marks around the
harmony with nature.
<q> element.
</q>
</p>

ETL LABS PVT LTD – PHP 144


Abbreviation Tag
The HTML <abbr> element defines an <p>
abbreviation or an acronym. The
19
5 <abbr title="World Health
Organization">
Marking abbreviations can give useful
WHO
information to browsers, translation
</abbr>
systems and search-engines.
was founded in 1948.
</p>

ETL LABS PVT LTD – PHP 145


Comment Tags
You can add comments to your HTML source by
20
5 using the following syntax

<!-- Write your comments here -->

ETL LABS PVT LTD – PHP 146


Anchor Tag
The href attribute is used to define the
address of the file to be linked. In other
words, it points out the destination page.
The syntax of HTML anchor tag is given
below.
21
5
<a href = "..........."> Link Text
</a>

Let's see an example of HTML anchor tag.

<a href="second.html">Click for


Second Page</a>

ETL LABS PVT LTD – PHP 147


Image Tags
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.

22
5 Let's see an example of HTML image.

<img src="good_morning.jpg" alt="Good Morning


Friends"/>
Attribute of image tag

<img src="animal.jpg" height="180"


width="300" alt="animal image">

ETL LABS PVT LTD – PHP 148

S-ar putea să vă placă și