HTML Attributes

HTML Attributes

HTML Attributes

An opening tag may also contain one or more attributes. An attribute is extra information that defines how the element looks and/or behaves. Some elements require certain attributes, and almost any element can take optional attributes.

An attribute is always found in the opening tag of an HTML element. Most have the syntax name=“value” though some attributes only require the name without any assigned value.

Let’s look at another element, the a (anchor) element. This element creates a hyperlink. It requires one attribute called href that specifies the destination URL.

(Note that in the example below, the code module won’t open the new page if you click the link due to the module’s limitations. On an actual web page, clicking the link would bring you to birajmedia.com.)

The a element can also take other optional attributes. For example, adding the attribute target=“_blank” makes the link open in a new tab or window.

Codpen:

https://codepen.io/Biraj-Media/pen/yLdKgWe

Attributes can be written in any order inside the opening tag. However, you shouldn’t put multiple instances of the same attribute inside the same HTML tag. If this happens, generally, only the last instance of the attribute is considered.

CATEGORIES
TAGS
Share This
0 0 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
MURITALA ADESHINA
3 months ago

Wahoo this is good

MURITALA ADESHINA
3 months ago

Well done device is good and well okay thanks for letting me know about the site

Akande Joseph
3 months ago

Lemme go and learn more about this

//feewostoo.com/4/8035521
Why?
3
0
Would love your thoughts, please comment.x
()
x