test

Thursday, 22 September 2022

What is an attribute?

 An attribute is used to define the characteristics of an HTML element and is placed inside the element's opening tag. All attributes are made up of two parts − a name and a value.

1. The name is the property we want to set. For example, the paragraph <p> element in the example carries an attribute whose name is align, which you can use to indicate the alignment of paragraph on the page.

2. The value is what you want the value of the property to be set and always put within quotations. The below example shows three possible values of align attribute: left, center and right.

For Example :-

This example shows bgcolor or text is the name of attribute and “green” or “Red” is

Example (Alignment Program)

<!DOCTYPE html>

<html>

<head>

<title>Attribute Example</title>

</head>

<body bgcolor=”green” text=”red”>

<p align = "left">This is left aligned</p>

<p align = "center">This is center aligned</p>

<p align = "right">This is right aligned</p>

</body>

</html>




0 Comments:

Post a Comment