Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 4, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 4, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 4, 2025

      Smashing Animations Part 4: Optimising SVGs

      June 4, 2025

      I test AI tools for a living. Here are 3 image generators I actually use and how

      June 4, 2025

      The world’s smallest 65W USB-C charger is my latest travel essential

      June 4, 2025

      This Spotlight alternative for Mac is my secret weapon for AI-powered search

      June 4, 2025

      Tech prophet Mary Meeker just dropped a massive report on AI trends – here’s your TL;DR

      June 4, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025
      Recent

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025

      Simplify Negative Relation Queries with Laravel’s whereDoesntHaveRelation Methods

      June 4, 2025

      Cast Model Properties to a Uri Instance in 12.17

      June 4, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025
      Recent

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025

      Rilasciata /e/OS 3.0: Nuova Vita per Android Senza Google, Più Privacy e Controllo per l’Utente

      June 4, 2025

      Rilasciata Oracle Linux 9.6: Scopri le Novità e i Miglioramenti nella Sicurezza e nelle Prestazioni

      June 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Tech & Work»Lesser Known Uses Of Better Known Attributes

    Lesser Known Uses Of Better Known Attributes

    January 8, 2025

    The list of attributes available in HTML is long and well-documented. Even if you haven’t memorized them (and there’s totally nothing wrong with an author… er… random person off the street, who has), there are a bunch of places where HTML attributes you’re familiar with will have different or more specific jobs. Let’s take a look.

    name

    You may have heard of the name attribute, giving a name/label to information sent through a form. And more specifically you may have used it to bring together a set of radio buttons, but you can also use it with the details element to have only one of a set of accordions open at a time.

    Like if you have more than one refrigerator in the office at work, any respectable person would only open one door at a time. Right, Bob?

    <details name="office-kitchen">
      <summary>Refrigerator 1</summary>
      Lunches, condiments, yogurt et al.
    </details>
    <details name="office-kitchen">
      <summary>Refrigerator 2</summary>
      More Lunches, leftovers from client meeting, stray cans of off-brand soda et al.
    </details>
    <details name="office-kitchen">
      <summary>Refrigerator 3</summary>
      Cookie dough someone bought from somebody’s child’s fundraiser, expired milk, unidentifiable meat et al.
    </details>
    

    See the Pen Name [forked] by Undead Institute.

    title

    You’ve probably heard of the universal attribute title. It’s typically thought of as the built-in tooltip text, but three elements have special semantics for the title attribute: input and the rarely used gems, the definition (dfn) element, and the abbreviation (abbr) element.

    If you’re using a pattern attribute on an input to provide some regex-based error correction, then you should definitely tell the user how to meet the criteria you’re using. The title attribute can be used both as a tooltip and as the message shown when the user doesn’t meet that criteria.

    <form method="post" action="#">
      <label>Who took my <em>well labeled</em> yogurt from the company fridge? I know it was you, Bob.<br>
        <input type="text" pattern="Bob [A-Za-z].+" title="There are many Bobs. The only question is which one it was. Please limit your answers to Bob and his/her last name.">
      </label><br>
      <button type="submit">Submit</submit>
    </form>
    

    See the Pen Title – Input [forked] by Undead Institute.

    For a dfn element, if you use the title attribute, then it has to include the term being defined. dfn should still have text in it, but it can be an abbreviation or a different form of the term.

    <p><dfn title="Office Yogurt Thief">OYG</dfn>’s are a pox on humanity. Stealing yogurts from the office fridge even when they are labeled.</p>
    

    See the Pen Title – dfn [forked] by Undead Institute.

    A title on an abbr element not only sets the tooltip but explicitly has the expansion of the abbreviation or acronym. As it says in the spec: “The [title] attribute, if specified, must contain an expansion of the abbreviation, and nothing else.” That’s the specification’s equivalent of threatening a mafia hit if you aren’t careful with your title attributes. You have been warned, Bob.

    When dealing with a suspected yogurt thief, we must create a <abbr title="Human Resources Special Task Force on Yogurt Theft">HRSTFYT</abbr> to deal with the problem.
    

    See the Pen Title – abbr [forked] by Undead Institute.

    value

    The value attribute is well known for setting default values on inputs, but you can also use it on a list item (li) within an ordered list (ol) to change the number of that item and all that follow it. It only takes integers, but you can use it no matter what type of ordered list you use (numeric, alphabetical, or Roman numerals).

    <h1>Favorite Co-workers</h1>
    <ol>
      <li>Tina</li>
      <li>Keesha</li>
      <li>Carlos</li>
      <li>Jamal</li>
      <li>Scott</li>
      <li value="37">Bob</li>
      <li>Bobbie</li>
      <li>Bobby</li>
      <li>"Rob"</li>
    </ol>
    

    See the Pen Value [forked] by Undead Institute.

    datetime

    You might have used a datetime attribute on a time element to provide a machine-readable format of the time and/or date represented in the time element’s text:

    <time datetime="2024-12-09">Dec. 12, 2024</time>
    

    The same attribute can also be used with the ins and del elements (used for notating an addition/insertion and deletion of content, respectively). The datetime attribute on ins and del provides a machine-readable date (and optionally a time) for when the change was made. You can show it to the visitor if you like, but it’s mainly intended for private use.

    Check out the edits of the original version of an earlier example:

    When dealing with a <ins datetime="2024-11-17">suspected</ins> yogurt thief <del datetime="2024-11-17">, like Bob,</del> we must create a <abbr title="Human Resources Special Task Force on Yogurt Theft">HRSTFYT</abbr> to deal with <del datetime="2024-11-17">Bob</del> <ins datetime="2024-11-17">the problem</ins>.
    

    See the Pen Datetime [forked] by Undead Institute.

    As an added note, screenreaders do not announce the datetime attribute in this context.

    cite

    Sticking with our oft-neglected friends ins and del, the cite attribute that you use on blockquote and q elements to provide a URL of the source of the quotation can also be used on ins and del to provide the URL of a document explaining the changes.

    When dealing with a <ins datetime="2024-11-17" cite="https://codepen.io/undeadinstitute/full/VYZeaZm">suspected</ins> yogurt thief <del datetime="2024-11-17" cite="https://codepen.io/undeadinstitute/full/VYZeaZm">, like Bob,</del> we must create a <abbr title="Human Resources Special Task Force on Yogurt Theft">HRSTFYT</abbr> to deal with <del datetime="2024-11-17" cite="https://codepen.io/undeadinstitute/full/VYZeaZm">Bob</del> <ins datetime="2024-11-17" cite="https://codepen.io/undeadinstitute/full/VYZeaZm">the problem</ins>.
    

    See the Pen Cite [forked] by Undead Institute.

    Again, these dates are not announced in assistive tech, like screen readers.

    multiple

    You probably know the multiple attribute as that more-than-meets-the-eye attribute that transforms a dropdown menu into a multi-select box, like a co-worker who lets you choose two donuts from the box. (I’m lookin’ at you, Tina.) But it has two other uses as well. You can add it to both a file input and an email input to accept multiple files and emails, respectively.

    <form method="post" action="#">
      <label>Upload complaint forms (about Bob) <input type="file" multiple> </label><br>
      <label>Email all of Bob’s bosses: <input type="email" multiple></label><br>
      <button type="submit">Submit</submit>
    </form>
    

    Just be sure that the emails are comma-separated.

    See the Pen Multiple [forked] by Undead Institute.

    for

    In your travels across the internet, you’ve probably come across the for attribute when it’s used to associate a label element with a form field (input, select, textarea, etc.), but you can also use it to explicitly associate the elements of a calculation with an output element.

    Unlike a label–input relationship, which is a one-to-one relationship (i.e., one label for one field), the for attribute used on an output can hold an unordered, space-separated list of IDs of the fields that contributed to the calculation.

    <form method="post" action="#" id="comeuppance"> 
      <fieldset><legend>Defendant name</legend>
        <label>First Name: <input name="fname" type="text"></label>
        <label>Last Name: <input name="lname" type="text"></label>
      </fieldset>
      <label>Number of yogurts stolen (unlabeled): 
        <input name="numunlbld" id="numstolen-unlbld" type="number">
      </label> * 
      <label>Unlabeled Multiplier: 
        <input name="multiunlbld" id="multi-unlbld" type="number" value="0.5">
      </label> + 
      <label>Number of yogurts stolen (labeled): 
        <input name="numlbld" id="numstolen-lbld" type="number">
      </label> * 
      <label>Labeled Multiplier: 
        <input name="multilbld" id="multi-lbld" type="number" value="1.5">
      </label> = 
      <label>Suggested prison term (in years):
        <output id="answer" for="numstolen-unlbld numstolen-lbld multi-unlbld multi-lbld"></output>
      </label>
    </form>
    

    See the Pen For [forked] by Undead Institute.

    target

    Just like you can use a target attribute to open a link in a new tab/window, you can use the same target attribute and value _blank to have a form open the response in a new tab/window.

    <form method="post" action="#" id="comeuppance" target="_blank"> 
      [...]
    </form>
    

    disabled

    You may have used the disabled attribute to knock out an individual form field, but you can also use it to disable every descendant of a fieldset element.

    No matter what HR says and its innocent-until-proven-guilty ethos, we all know Bob did it. Don’t we?

    <form method="post" action="#" id="comeuppance"> 
      <fieldset disabled><legend>Defendant name</legend>
        <label>First Name: <input name="fname" type="text" value="Bob"></label>
        <label>Last Name: <input name="lname" type="text" value="McBobberson"></label>
      </fieldset>
      [...]
    </form>
    

    See the Pen Disabled [forked] by Undead Institute.

    Attribute Selectors

    While not technically an HTML tip, attributes can also be used as selectors in CSS. You put square brackets around the attribute name and you’ll select all elements that contain that attribute.

    <style>
      [title] {
        background-color: red;
      }
    </style>
    <h1>List of <del>Suspects</del><ins>Co-workers</ins></h1>
    <ol>
      <li>Fred</li>
      <li>Rhonda</li>
      <li>Philomina</li>
      <li>Cranford</li>
      <li>Scott</li>
      <li title="the guilty one">Bob</li>
      <li>Bobbie</li>
      <li>Bobby</li>
      <li>"Rob"</li>
    </ol>
    

    See the Pen Attribute Selector [forked] by Undead Institute.

    There’s actually a whole lot more you can do with attribute selectors, but that’s the topic of another article — literally.

    Wrapping Up

    Okay, now that we’ve learned some trivia we can use to properly prosecute Bob’s office and yogurtorial transgressions, do you have a favorite HTML attribute I didn’t discuss? Show off your personal life-of-the-party energy in the comments. (And, yes, cool people have a favorite HTML attribute… really cool people… right? Right?? Right!?!?!?!?!)

    Source: Read More 

    news
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleState-aligned APT groups are increasingly deploying ransomware – and that’s bad news for everyone
    Next Article Google’s Geocoding APIs: Frontend and Backend Implementation

    Related Posts

    Tech & Work

    The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

    June 4, 2025
    Tech & Work

    How To Fix Largest Contentful Paint Issues With Subpart Analysis

    June 4, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    OmniGlue: The First Learnable Image Matcher Designed with Generalization as a Core Principle

    Development

    Findlay Automotive Hit by Cybersecurity Attack, Investigation Ongoing

    Development
    Rilasciata IPFire 2.29 Core Update 193: Un passo avanti nella sicurezza con la crittografia post-quantistica

    Rilasciata IPFire 2.29 Core Update 193: Un passo avanti nella sicurezza con la crittografia post-quantistica

    Linux

    I grew up on a farm. These are the tools I recommend for gardening

    News & Updates

    Highlights

    Rack Ruby vulnerability could reveal secrets to attackers (CVE-2025-27610)

    April 25, 2025

    Rack Ruby vulnerability could reveal secrets to attackers (CVE-2025-27610)

    Researchers have uncovered three serious vulnerabilities in Rack, a server interface used by most Ruby web app frameworks (Ruby on Rails, Sinatra, Hanami, Roda, and others).
    Two of the flaws – CVE-202 …
    Read more

    Published Date:
    Apr 25, 2025 (2 hours, 26 minutes ago)

    Vulnerabilities has been mentioned in this article.

    CVE-2025-34028

    CVE-2025-27610

    CVE-2025-27111

    CVE-2025-25184

    Unlocking Specialized AI: IBM’s InstructLab and the Future of Fine-Tuned Models — IBM Think 2024

    May 28, 2024

    Perficient Obsesses Over Outcomes to Drive Client Success Through Expertise and Innovation

    April 17, 2025

    Black Basta Ransomware Affiliates Possibly Exploited Windows Bug as a Zero-Day

    June 12, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.