test

Thursday, 22 September 2022

What is an HTML Element and tag?

 An HTML element is an individual component of an HTML document. It represents semantics, or meaning. An HTML element is defined by a start tag, some content, and an end tag. For Example:-

<tagname>Content goes here...</tagname>

There are two types of tags are used in HTML. They are:

1. Container tag

2. Empty Tag

1 Container Tag:- The HTML element is everything from the start tag to the end tag, these tags are called container tag. For Example:-

<h1>My First Heading</h1>

<p>My first paragraph.</p>

2 Empty Tag :- Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!

Answer:- 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>

the value of attribute of <body>element.

For Example: <BR>, <Img>,<input>,<linl> <frame> Etc.




0 Comments:

Post a Comment