Computer Science, asked by Aishwarya919, 10 months ago

Explain html element and attribute with an example each

Answers

Answered by zohra1112
4

Answer:

An HTML element usually consists of a start tag and an end tag, with the content inserted in between:

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

The HTML element is everything from the start tag to the end tag:

eg:<p>My first paragraph.</p>

Attributes

All HTML elements can have attributes

Attributes provide additional information about an element

Attributes are always specified in the start tag

Attributes usually come in name/value pairs like: name="value"

1:The href Attribute

HTML links are defined with the <a> tag. The link address is specified in the href attribute:

eg:<a href="https://www.w3schools.com">This is a link</a>

2:HTML images are defined with the <img> tag.

The filename of the image source is specified in the src attribute:

eg:<img src="img_girl.jpg">

3:HTML images also have width and height attributes, which specifies the width and height of the image

eg:<img src="img_girl.jpg" width="500" height="600">

Similar questions