Skip to main content
HTML Attributes You May Not Be Using
Hello everyone in this blog we will see some HTML Attributes which is very useful but many of you don't know or never use them.
So for your better understanding, we will see some attributes with examples.
for that here is the list
1. contenteditable: This is the first attribute that is useful and you never use it .this attribute belongs to "Global Attributes". It specifies whether the content of an element is editable or not. When the contenteditable attribute is not set on an element, the element will inherit it from its parent
example:
<p contenteditable="false">This is an noneditable paragraph.</p>
2. download: The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.
This attribute is only used if the href attribute is set.
The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).
If the value is omitted, the original filename is used.
The download attribute can be used on the following elements:
<a> and <area>
example:
<a> tag example
<a href="/images/myimage.jpg" download>
<area> tag example
<area shape="circle" coords="90,58,3" alt="Mercury" href="merglobe.gif" download="mercury">
3. hidden: The hidden attribute is a boolean attribute.
When present, it specifies that an element is not yet, or is no longer, relevant.
Browsers should not display elements that have the hidden attribute specified.
The hidden attribute can also be used to keep a user from seeing an element until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript could remove the hidden attribute, and make the element visible.
example:
<p hidden>This paragraph should be hidden.</p>
4. multiple: The multiple attributes is a boolean attribute.
When present, it specifies that the user is allowed to enter/select more than one value.
example:
<form action="/action_page.php">
Select images: <input type="file" name="img" multiple><input type="submit">
</form>
5. poster: The poster attribute specifies an image to be shown while the video is downloading, or until the user hits the play button.
If this is not included, the first frame of the video will be used instead.
example:
<video controls poster="/images/w3html5.gif">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag.</video>
6. spellcheck: The spellcheck attribute specifies whether the element is to have its spelling and grammar checked or not.
The following can be spellchecked:
- Text values in input elements (not password)
- Text in <textarea> elements
- Text in editable elements
example:
<p contenteditable="true" spellcheck="true">This is a paragraph.</p>
So these are the Attributes which are very useful to know.If you already know them then it's great for you to .your are a good learner you learn things in deep and use them well but if not then this article will be very useful for maybe it can solve your many problems.
And if you know some useful not known attribute please tell us in comments.
Thank you for reading if you find useful this article please share it with friends and tell them about these attributes.
Yes I don't know one of them
ReplyDelete