top of page
HTML5.png

HTML

TAG ATTRIBUTE

  • An attribute is used to define the characteristics of an HTML element/tag.

  • Attribute is also called as property of an HTML element.

  • It is placed inside the element’s opening tag.

  • All attributes are made up of two parts:-

  1. Name   

  2. Value

  • Name:- Name is the property we want to set in an element.

  • Value:- The value is what we want to set related to the name and then it displays its effect.

  • Example:-                          

<body bgcolor="blue">

.

.

.

</body>

​

In the above example "bgcolor" is the attribute name and BLUE is the attribute value of the <body> tag. This attribute of <body> tag defines that the background color of the html body will be blue.

​

BODY BACKGROUND COLOR

  • This is an attribute which is used inside the <body> tag to change the background color of the body.

  • Example:-                          

<html>

<head>

<title> BGCOLOR EXAMPLE </title>

</head>

<body bgcolor="yellow">

NAME:- SUNIL KUMAR SAHU

</body>

</html>

​

OUTPUT:

bgcolor.JPG

ALIGN ATTRIBUTE IN PARAGRAPH TAG

  • Paragraph tag uses align attribute.

  • Tag name : <p>

  • Attribute name : align

  • Attribute value :

a) left

b) right

c) centre

  • Example:-                          

<html>

<head>

<title> ATTRIBUTE </title>

</head>

<body>

<p align="left">SUNIL</p>
<p align="center">KUMAR</p>
<p align="right">SAHU</p>

</body>

</html>

​

OUTPUT:

alignattr.JPG

Related Topics

bottom of page