• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

active/ hover state has color above link

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › active/ hover state has color above link

This topic is: resolved

Tagged: nav

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 7 months ago by Kevin.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 2, 2014 at 10:40 pm #116795
    Kevin
    Member

    I like the way this nav works. I looked at code inspector but I cannot figure out how the color is added on hover/ active states (as a background) but doesn't interfere with the link text. Any ideas how this is done?

    August 4, 2014 at 9:32 am #117001
    David Chu
    Participant

    Hi,
    That was a really tricky little CSS brainteaser. I had to look very closely. I can tell you the basic concept, but you'd still be in for some work to put it in your context. If you're a CSS geek, you could pull it off. Here's what happens... you hover over the link, so far so good, but there's no obvious hover link code that makes the yellow gunk show up! BUT...inside each link is a <b> tag, which is not used semantically, but instead is used to display itself absolutely positioned way above the link with its yellow gunk. In the following code, the hover is set to make it show up (the opacity part).

    .sf-menu > li > a:hover b, .sf-menu > li.sfHover > a b, .sf-menu > li.current-menu-item > a b {
    outline: 0;
    opacity: 1;
    }

    Then in turn, this stuff is visible (because it's now opaque).

    .sf-menu > li > a b {
    position: absolute;
    left: 0;
    right: 0;
    top: -82px;
    height: 61px;
    background: #FC0;
    display: block;
    opacity: 0;
    transition: all 400ms linear;
    -o-transition: all 400ms linear;
    -moz-transition: all 400ms linear;
    -webkit-transition: all 400ms linear;
    }

    Just crazy. It's very fancy and incredibly cute, but pretty precious to code, and I don't really care for code that's this complicated. It also won't work if someone is viewing this with out-of-date IE.

    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

    August 4, 2014 at 11:09 am #117025
    Kevin
    Member

    Thanks for looking into this and providing the code Dave,
    I'll try it and see how it looks.

    August 4, 2014 at 12:59 pm #117037
    David Chu
    Participant

    You're welcome, Kevin.

    And as I think about it, you could probably "junk-IE-proof" this by using some flavor of "display" or "visibility" instead of hipster "opacity", especially when changing opacity from zero to one doesn't even take advantage of, well, opacity. ๐Ÿ˜‰

    Good luck,
    Dave


    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

    August 8, 2014 at 11:44 am #117798
    Kevin
    Member

    ๐Ÿ™‚ Good point. Thanks

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘active/ hover state has color above link’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble