Certainly! Here's a refined version with code examples for each attribute:
- 1. Spellcheck: This attribute ensures that the browser checks spelling within specific elements, such as input fields or text areas, without requiring JavaScript. It's particularly useful for forms or content where accuracy matters.
<textarea spellcheck="true"></textarea>
- 2. Download:
The
download
attribute allows users to download resources directly when clicking on a link. It's handy for providing downloadable content like images, documents, or media files without JavaScript.
<a href="path/to/file.pdf" download>Download PDF</a>
- 3. Video Thumbnail (Poster):
By using the
poster
attribute in the<video>
element, you can specify an image to display as a placeholder before the video starts playing. This mimics the functionality of a video thumbnail, enhancing user experience.
<video controls poster="path/to/thumbnail.jpg">
<source src="path/to/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
- 4. Translate:
Employing the
translate
attribute, you can specify whether an element's content should be translated when a webpage is translated into another language. Setting it to "no" preserves the original content, useful for brand names or specific terms.
<h1 translate="no">Your Company Name</h1>
- 5. Autocomplete:
The
autocomplete
attribute enables or disables autocomplete functionality for input fields, providing control over whether the browser should suggest previously entered values. This can enhance user convenience and streamline form submission.
<input type="text" autocomplete="on">
If you'd like to show your support for my work, you can buy me a coffee through the following link: Buy Me a Coffee. Your generosity helps fuel my creativity and allows me to continue sharing valuable content. Thank you for your support!
Sources:
- Spellcheck: MDN Web Docs - Spellcheck Attribute
- Download: MDN Web Docs - Download Attribute
- Video Thumbnail (Poster): MDN Web Docs - Poster Attribute
- Translate: MDN Web Docs - Translate Attribute
- Autocomplete: MDN Web Docs - Autocomplete Attribute
Top comments (22)
Nice list! Also the Popover API is getting better support: developer.mozilla.org/en-US/docs/W... and can be used declaratively
Web Dev Simplified released a video demoing that six months ago. Pretty cool.
Yeah β€οΈ
Interesting, Thanks for sharing πͺ
Amazing
What a great post!!! Thanks.
Spellcheck: The example showcasing the spellcheck attribute in a textarea effectively demonstrates its utility for ensuring accurate spelling in user inputs without relying on JavaScript.
Autocomplete: The autocomplete attribute's role in controlling browser suggestions for input fields is effectively communicated through a clear example, emphasizing its potential to streamline user interactions.
good work:)
Thank You :)
WYSIWYG editors can ignore or remove empty download attributes. So, it would help if you used the following syntax:
<a href="/images/myw3schoolsimage.jpg" download="w3logo">
Thanks π
I like it, and I will use it in my project
Glad to Know that, Thank You :)
Good work, this is my first time knowing this attributes thanks and keep the good work.
Glad to know that, I hope you use this in your day to day work. Thank You :)
Cool, Will try to use when the requirement comes across.
Nice post π
Great! Finally a download option easy. Thanks
Excelent! thanks