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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

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

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 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

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»HTML popover Attribute

    HTML popover Attribute

    April 15, 2024

    Modals have been an important part of websites for two decades. Stacking contents and using fetch to accomplish tasks are a great way to improve UX on both desktop and mobile. Unfortunately most developers don’t know that the HTML and JavaScript specs have implemented a native modal system via the popover attribute — let’s check it out!

    The HTML

    Creating a native HTML modal consists of using the popovertarget attribute as the trigger and the popover attribute, paired with an id, to identify the content element:

    <!–
    “popovertarget” attribute will map to “id” of popover contents
    –>
    <button popovertarget=”popover-contents”>Open popover</button>
    <div id=”popover-contents” popover>This is the contents of the popover</div>

    Upon clicking the button, the popover will open. The popover, however, will not have a traditional background layer color so we’ll need to implement that on our own with some CSS magic.

    The CSS

    Styling the contents of the popover content is pretty standard but we can use the browser stylesheet selector’s pseudo-selector to style the “background” of the modal:

    /* contents of the popover */
    [popover] {
    background: lightblue;
    padding: 20px;
    }

    /* the dialog’s “modal” background */
    [popover]:-internal-popover-in-top-layer::backdrop {
    background: rgba(0, 0, 0, .5);
    }

    :-internal-popover-in-top-layer::backdrop represents the “background” of the modal. Traditionally that UI has been an element with opacity such to show the stacking relationship.

    The post HTML popover Attribute appeared first on David Walsh Blog.

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleThis AI Paper from SambaNova Presents a Machine Learning Method to Adapt Pretrained LLMs to New Languages
    Next Article Timing is Everything: The Role of Just-in-Time Privileged Access in Security Evolution

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4831 – TOTOLINK HTTP POST Request Handler Buffer Overflow Vulnerability

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Critical RCE Vulnerability in Erlang/OTP SSH Server Impacts Multiple Cisco Products

    Security
    Rilasciato Agama 13: Un passo avanti per l’installazione di openSUSE e SUSE Linux Enterprise

    Rilasciato Agama 13: Un passo avanti per l’installazione di openSUSE e SUSE Linux Enterprise

    Linux

    Skyblivion mod team explains its Oblivion remake against Bethesda’s remaster — Here’s which you should play first

    News & Updates

    How to Subscribe to Salesforce Reports

    Development

    Highlights

    5 browser extension rules to live by to keep your system safe in 2025

    January 7, 2025

    If you use browser extensions, you should be careful about which ones you install and…

    Free DOOM: The Dark Ages Premium Edition? NVIDIA is making it happen.

    April 30, 2025

    How to Set Up Automated GitHub Workflows for Your Python and React Applications

    November 7, 2024

    Detect and protect sensitive data with Amazon Lex and Amazon CloudWatch Logs

    July 26, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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