Best Website-BuildersBest Website-Builders
    What's Hot

    Where next for Scotland as the Nicola Sturgeon era ends?

    March 26, 2023

    13 Best Deals: TVs, Headphones, and Office Gear

    March 26, 2023

    World Match Play Championship: Rory McIlroy beats Xander Schauffele to reach semi-final

    March 26, 2023
    Facebook Twitter Instagram
    Facebook Twitter Instagram
    Best Website-BuildersBest Website-Builders
    • Home
    • CSS

      6 best e-books about technology and the people behind it

      March 25, 2023

      How to optimize Next.js fonts with @next/font

      March 25, 2023

      RCMP Phone Tracking Continues Despite Privacy Concerns

      March 25, 2023

      OpenAI Reveals Redis Bug Behind ChatGPT User Data Breach Incident

      March 25, 2023

      CSS’s Ledenkov and Bostedt, UWS’ Meylan named All-American

      March 24, 2023
    • Joomla

      Save Thousands On Web Hosting With iBrave, Now Only $86

      March 23, 2023

      In Vitro Transcription Services Market Analysis, Research Study with Shanghai Zhishuo Biotechnology Co., Yunzhou Biotechnology Co.

      March 23, 2023

      Current state of UK content management systems

      March 23, 2023

      Reseller Hosting Business: Important Q&A

      March 21, 2023

      Web Hosting: 8 Elements Every Entrepreneur Should Look For

      March 20, 2023
    • PHP

      These are comfortable shoes nurses wear for standing all day

      March 25, 2023

      Mississippi tornado kills at least 24, uproots town

      March 25, 2023

      Ja Morant’s suspension puts him in the spotlight

      March 25, 2023

      Kelly Ripa and Mark Consuelos’ marriage is horny

      March 25, 2023

      Naomi Osaka gives birth These are her pregnancy products she swears by.

      March 25, 2023
    • UX

      Iberia named world’s most punctual airline in January

      March 25, 2023

      Hungama launches the highly anticipated all-in-one app that seamlessly integrates music and movies for an unparalleled user experience.

      March 25, 2023

      Fort Worth All-Women’s Robotics Team Fights for State Title – NBC 5 Dallas-Fort Worth

      March 25, 2023

      Fort Worth All-Women’s Robotics Team Fights for State Title – NBC 5 Dallas-Fort Worth

      March 24, 2023

      Navigating Algorithms: Tips and Tricks for SEO Success | Recommended

      March 24, 2023
    • Web Builders
      1. Web Design
      2. View All

      What Comes First in Website Development — Design or Copy?

      February 2, 2023

      Modern Campus Honors Best Higher Education Websites of 2022

      February 2, 2023

      Premier SEO Consultant in Las Vegas, Nevada with Unparalleled Customer Service

      February 2, 2023

      Can Religious Freedom Be Saved? This group is racing the clock to teach America’s first freedom

      February 2, 2023

      How i Create New Google Account

      February 7, 2023

      CWT powers tools for meeting and event planners

      January 31, 2023

      Best Website Builder – Website Builders

      January 24, 2023

      Is There A Market For Rap-Themed Slot Games? – Rap Review

      January 19, 2023
    • WordPress

      New Pixel Tablet leak contains images of Pixel Stand accessories

      March 25, 2023

      Sonos Move 2 could arrive in the coming months

      March 25, 2023

      Businesses Worry About the Dark Web, But They Are Not Doing Much

      March 25, 2023

      Quordle today – Tips and Answers for Saturday March 25th (Game #425)

      March 25, 2023

      This $399 AMD-based One-Eyed PC Is One Of The Weirdest Designs I’ve Seen In 25 Years

      March 25, 2023
    • Realtoz
      • Our Other Sites
    • More News
    Best Website-BuildersBest Website-Builders
    Home » How can I force hover to trigger another hover in CSS? – HTML and CSS – SitePoint Forum
    CSS

    How can I force hover to trigger another hover in CSS? – HTML and CSS – SitePoint Forum

    websitebuildersnowBy websitebuildersnowJanuary 30, 2023No Comments3 Mins Read
    Facebook Twitter LinkedIn Telegram Pinterest Tumblr Reddit WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    How can I force a hover to trigger another hover with CSS? What’s an example?



    Paul OB


    January 30, 2023 at 1:05 PM


    2

    It depends on exactly what you want, so you can start with an example and say what you want to do instead.

    You can’t actually trigger a hover to something else, but you can change something else while hovering elsewhere (depending on structure). For example, when you hover over a div, you can style the child elements while the parent is hovered. Alternatively, you can style the adjacent element, but lose the effect on the adjacent element as soon as you release the mouse (unlike child elements, which can stay). Always active while parent is hovered.
    )

    In CSS, you can use the ‘:hover’ and ‘:active’ pseudo-classes to make one hover trigger another. Here’s an example of how to do this:

    HTML:

    <div class="container">
      <div class="hover-1">Hover 1</div>
      <div class="hover-2">Hover 2</div>
    </div>
    

    CSS:

    .container {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100vh;
    }
    
    .hover-1:hover + .hover-2 {
      background-color: yellow;
    }
    
    .hover-2:active {
      background-color: red;
    }
    

    In this example, when hovering over the “Hover 1” element, the “Hover 2” element will have a yellow background. Click on “Hover 2” and the background color will change to red.

    Note that this method will only work if the second hover element is a sibling of the first hover element and is positioned immediately after the first. The “+” selector is used to select his second element that immediately follows the first.


    Paul OB


    February 6, 2023 10:46 AM


    Four

    zuhaybtaha210:

    n CSS, you can make one hover trigger another

    No, you can’t trigger the hover state with something else, as already explained above. :slight_smile:

    As shown in my demo, you can style different elements based on hovering siblings. The demo is pretty much the same, but uses adjacent selectors that limit the scope to only the following elements:

    As Paul says, you can “fake” activating hover states for siblings/descendants etc. You can (usually) do it both ways too.But it’s worth pointing out that it’s not actual Enable hover states on other elements. This can be an important difference for Javascript, etc.



    1 like

    Hi @zuhaybtaha210, welcome to the forums.

    Just to let you know, you can format your code using A button in the menu at the top of the text editor.

    This wraps the code at the tick start and end ``` your code here ```

    this time i did it for you :slight_smile:



    1 like



    Source link

    Share this:

    • Tweet
    • Email
    • Pocket
    • Mastodon
    • WhatsApp
    • Telegram
    • Share on Tumblr
    • Print
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email
    Previous ArticleCybertech Global 2023: The Importance of User Experience (UX) in Cyber ​​Products
    Next Article Digital Skills Festival Welcomes Top Tech Companies
    websitebuildersnow
    • Website

    Related Posts

    6 best e-books about technology and the people behind it

    March 25, 2023

    How to optimize Next.js fonts with @next/font

    March 25, 2023

    RCMP Phone Tracking Continues Despite Privacy Concerns

    March 25, 2023
    Add A Comment

    Leave a Reply Cancel reply

    Top Posts

    Subscribe to Updates

    Get the latest sports news from SportsSite about soccer, football and tennis.

    Advertisement
    Demo

    This website provides information about CSS and other things. Keep Supporting Us With the Latest News and we Will Provide the Best Of Our To Makes You Updated All Around The World News. Keep Sporting US.

    Facebook Twitter Instagram Pinterest YouTube
    Top Insights

    Where next for Scotland as the Nicola Sturgeon era ends?

    March 26, 2023

    13 Best Deals: TVs, Headphones, and Office Gear

    March 26, 2023

    World Match Play Championship: Rory McIlroy beats Xander Schauffele to reach semi-final

    March 26, 2023
    Get Informed

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    © 2023 bestwebsite-builders. Designed by bestwebsite-builders.
    • Home
    • About us
    • Contact us
    • DMCA
    • Privacy Policy

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