Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Html practice

Basic Syntax

<html>
<body>
<h1> Hello world </h1>
</body>
</html>

Another Syntax
<html>
<head>
<title> This is website</title>
</head>
<body>
<h1> Hey how Are you?</h1>
<p> website content goes here</p>
</body>
</html>

Another one
<html>
<head>
Document header related tags
</head>
<body>
Document body related tags
</body>
</html>

Html Basic Tags


1)<h1> heading tag<h1> h1 to h6 large to small font tags
2)<p> it is used for paragraph tags </p>
3)<br/> it is used to break the lines
4) <center> it is used to put any content in the center
5 <hr/> it is used to make horizontal line
6 <pre> it is used to write the text as per the wish of the coder </pre>

tags for aligning the text in left, right and center


1) <p align="left"> this is left aligned</p>
2)<p align="right> this is right aligned</p>
3)<p align="center> this is center aligned</p>
________________________________________________________________
________________________________________________________________
_____________

CORE ATTRIBUTES
In Html there are core attributes like
1)ID
2)title
3)class
4)style

1)ID attribute is use to uniquely identify any element within an html page
It is used to idntify two elements of the same name in the web page(or Style
sheet)
Example
<p id="html"> This explains what is Html</p>
<p id="css"> This explains what is css </p>

3)The class Attribute


> the class attribute is used to associate an element with a style sheet, and
specifies the class of element
example
<p style="font-family:arial;color:#FF0000;">Arbaaz </p>
output -> Arbaaz will display in red color

________________________________________________________________
________________________________________________________________
____________________________

Internationalization Attributes
1)dir
2)lan
3)xml:lang

1)dir attribute
-> the dir attribute allows you to indicate to the browser the direction in which
the text should flow
-> the dir attribute can take one of two values, as you can see below
ltr-> left to right
rtl-> right to left

syntax
<!DOCTYPE html>
<html dire="rtl>
<body>
HI this is arbaaz
</body>
</html>
output : the text we can see from right to left

2) lang Attribute
it is use to indicate the main language used in a document but it was used in
previous versions in we can also use in xml:lang for to indicate the main
language in html newer versions

<!DOCTYPE html>
<html dire="en">
<body>
HI this is arbaaz
</body>
</html>

________________________________________________________________
________________________________________________________________
_____________________________

HTML Formatiing
1)BOLD TEXT
<b> it is used to do bold text </b>
2)ITALIC TEXT
<i> it is used to do italic text</i>
3)UNDERLINE TEXT
<u> it is used to underline the text</u>
4)STRIKE TEXT
<strike>It is used to strike the text</strike>
5)SUPERSCRIPT TEXT
IT IS USED TO DISPLAY THE TEXT IN OTHER HEIGHT
<sup> hi how are you</sup>
6) SUBSCRIPT TEXT
IT IS USED TO DISPLAY THE TEXT HEIGHT BENEATH THE OTHER
CHARACTERS
<sub>hi how </sub>
Output
HI JO KAHA 
hi how

7) INSERTED TEXT
Anything that appears within <ins>..</ins> element is displayed as inserted text
Code
<p> I want to do job as a <del>Customer support</del> <ins>Software</ins>
Output
I want to do job as a Customer support Customer support Software
8) BIG text
This is used to make the text big
<big> </big>
Example
<p> the thing use a <big> gg</big>
Output

the thing use a gg

9)small text
This is used to make the text big
<small></small>
Example
<p> the thing use a <small> gg</small>
Output
the thing use a gg

10) Grouping Content


1)div tag
2)span tag
The <div> and <span> elements allow you to group together several elements
to create sections or subsections of a page
Where as in 1)div : it will group in block
Ex:<div> this is one line</div>
Yep, one line
OUTPUT:
this is one line
Yep, one line
Where as 2)Span : it will group in inline
EX:<span> this is one line</span>
Yep,one line
OUTPUT
this is one line yep,one line

Image Tag
<img src=”” alt=””
Example:
<img src="images/product201.jpg" alt="">

Links Tag
<a href="#home">home</a>

Lists
unorder list
<ul>
<li> betroot </li>
<li> soap </li>

Order list
<ol>
<li> soap </li>
<li> beetroot</li>s
</ol>

You might also like