What is the difference between Html Tag and html attribute?
Tell me the difference between Html Tag and html attribute.
Html tag is <html>, while html attribute is <html lang="en">
Tags are used to mark up the start and end of an HTML element.
ex : <p>
An attribute defines a property for an element, consists of an attribute/value pair, and appears within the element’s start tag.
ex : <img src="banner.gif" alt="banner">
Here is the link that might be useful, E-commerce Website
We write Html tag like: <html>,
and html attribute write like : <html lang="en">
A tag is a declaration of a HTML object whereas an Attribute is a property of an object.
Thanks to everyone for this information.
Actually, those answers are wrong. They have elements and tags mixed up. An HTML document is built up out of elements and attributes. The Elements are all nested with the HTML element being the outer level / root element. Now each element may also contain certain attributes. A P element might contain the text node "Hello, World!" and also a style attribute. Attributes are in key / value pairs so the style attribute would be set to some value.
Tags create elements and attributes. The tag <html lang=en"> creates an HTML element with a lang attribute with a value of "en". By convention we would call that whole thing the HTML tag and it creates the HTML element and its attributes.
To make matters worse, tags are not the only way to create elements. In HTML the HTML, HEAD and BODY elements are required but the tags are not. If you omit the tags then the element is there nonetheless.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
The tags describe document content
Attributes provide additional information about an element
An attribute defines property for a HTML tag like
<img src="xyz.png" alt="banner">
Here we can see that <img> is a html tag and "alt" is attribute of the img tag with the value "banner".
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread