Site logo

[Resolved] CSS Select a Hook Element in

Home Forums Support [Resolved] CSS Select a Hook Element in

Home Forums Support CSS Select a Hook Element in

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2571878
    twarrior

    Hello,

    We have a Block – Hook in generate_after_primary_menu

    The content of the block is created by a language plugin
    <a href="#" class="nturl notranslate es Spanish single-language flag" title="Spanish" data-lang="Spanish">Cas</a>

    To change the link properties we use:

    a.single-language {
    font-size: small;
    font-weight: 300;
    color: #222;
    }

    up to here everything is fine, BUT…

    We also use a Header element “Merged with Content” in homepage, and another in pages.

    We need the link color of a.single-language to white in the navigation of this header elements. (see images)

    how can we apply a different style to this link when it is in the Header element “Merged with Content”, from when it is in the normal navigation menu or in the sticky menu?

    Thanks

    #2571902
    twarrior

    Sorry, i add the website url

    #2572050
    David
    Staff
    Customer Support

    Hi there,

    the Merge with Content options wraps your site header in a div with the class of header-wrap

    So you can add that to your CSS selector when you want to target an element inside it eg.

    
    .header-wrap a.single-language {
        color: #fff;
    }
    #2572356
    twarrior

    Thanks for your reply David. That was one of the options we tried, but it doesn’t work well.

    That code makes the link also come out white in the “sticky navigation”.

    #2572429
    David
    Staff
    Customer Support

    Ah ok, try this:

    .header-wrap nav:not(.is_stuck) a.single-language {
        color: #fff;
    }

    So this will target that link if it is inside the nav element that has NOT got the is_stuck class ( which gets added when sticky ) that is inside the header-wrap 🙂

    #2574368
    twarrior

    Tested. Works ok. Thank you very much

    #2574460
    David
    Staff
    Customer Support

    Glad to hear that !

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.