HTML Legend Tag

WBOY
Release: 2024-09-04 16:21:50
Original
724 people have browsed it

Legend Tag is used to define a caption or title to the tag, and it is considered the first child of this element. Being a caption, it is usually placed on top of the frame. The purpose of is to create a surrounding box on the particular element’s content. The main purpose is to wrap the forms, images, content with the help of the fieldset also serve to describe the context of the information. In the following portion, we shall discuss the information on the tag as well as an example in-depth. The main motto of this article is to show how simple and creatively HTML elements Tags are used for a presentation.

Syntax

<legend>
……
</legend>
Copy after login

The HTML

element is placed within the element, and it is marked black border around it; and if you want a stylish or change the behavior of the frame, then CSS is used here. This tag is completely different from
tag. And this tag supports all the browsers like Chrome, android, firefox, Opera, Internet Explorer. And all these elements are uniform with all the browsers.

Code:

<fieldset>
<legend>
Text
</legend>
… Content
<fieldset>
Copy after login

Have to provide both the Starting and Ending Tags.

Attributes

In general, HTML tags has one or more attributes that provide a great aspect of an HTML element. The Legend Tag supports all the defined global attributes. Some attributes don’t support modern web browsers. The following table gives the tag attributes with their descriptions.

1. Tag-Specific Attributes

align: Defines an alignment of the title or caption given in the form with respect to the parent

.

Code:

<fieldset>
<legend align="center">Align
demo:</legend>
Copy after login

Note: For a clear alignment, it is better to use CSS-Align for the variations of an element.

2. Standard Attributes

The description of these attributes has already been discussed in the previous article.

  • Access key
  • class
  • dir
  • id
  • Style
  • lang
  • id
  • tab index
  • title

3. Global Attributes

The legend tag also accepts Previously discussed Global Attributes, which is a standard across all the HTML5 elements. Some are listed below:

Context

Define the Context

Dir

 The values give the path of the text.

Id

 Its identifier must match the value of a name.

Style

 Specifies the inline and external styles.

Lang

Determines the language used in the text.

Context

onabort It is called when a particular event has been aborted. For example, the web browser immediately video before it is completely downloaded.
onblur Defines the focus of the element.
oncancel Stops the processed event handler.
Onclick Triggers when a click is done
onchange When a click is done somewhere.
onfocus Triggered when the focus is on the given element
Define the Context

Dir

 The values give the path of the text.

Id

 Its identifier must match the value of a name.

Style

 Specifies the inline and external styles.

Lang

Determines the language used in the text.

4. Event Attributes

5. Other Attributes Are

onmouse down, onmouse up, onmouse over, onmouse move, onmouse out, on focus, on blur, onkey press,onkey down,onkey up. The tags that come with the tag are listed below: