Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 481223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:58:22+00:00 2026-05-13T00:58:22+00:00

When using multiple lists and hover states the ‘parent’ Cufon style replaces the child.

  • 0

When using multiple lists and hover states the ‘parent’ Cufon style replaces the child. In the following example, when you hover the Second Level link it will be replaced by a different weight.

Is there an option I can set so that the nested style stays the same or is this a bug/limitation within Cufon?

    <ul>
    <li><a href="#">Top Level</a></li>
    <li><a href="#">Top Level</a></li>
    <li><a href="#">Top Level</a><ul>
        <li><a href="#">Second Level</a></li>
        <li><a href="#">Second Level</a></li>
        <li><a href="#">Second Level</a></li>
    </ul>
    <li><a href="#">Top Level</a></li>
    <li><a href="#">Top Level</a></li>
</ul>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://github.com/sorccu/cufon/raw/master/js/cufon.js"></script>
<script type="text/javascript" src="http://github.com/sorccu/cufon/raw/master/fonts/Vegur.font.js"></script>


<script type="text/javascript">
    Cufon.replace('ul li a',{hover: true, fontWeight: 200});
    Cufon.replace('ul li ul a',{hover: true, fontWeight: 700}); 
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:58:22+00:00Added an answer on May 13, 2026 at 12:58 am

    Solution first: Use selectors which don’t create matches where the set of elements overlap.

    //selects only 1st level links
    Cufon.replace('ul:has(ul) > li   a', { hover: true, fontWeight: 200});
    //selects only 2nd level links
    Cufon.replace('ul:not(:has(ul)) a', { hover: true, fontWeight: 700});
    


    Explanation why your selectors + Cufon create problems

    The problem seems to originate from you selectors.

    ul li a --> selects all 8 occurrences of <a>
    ul li ul a --> selects only the 3 second-level occurrences of <a>
    

    This means you have actually specified the fontWeight twice for the second-level <a>-tags. Sadly Cufon doesn’t seem to apply only the expression which has the highest CSS specificity thus the behavior will depend on how Cufon internally stores multiple matches like this one.

    After a few tests it seems that Cufon applies the styles in the reverse order you call the replace() statements in. e.g.

    If you do

    Cufon.replace('ul li a',{hover: true, fontWeight: 200});
    Cufon.replace('ul li ul a',{hover: true, fontWeight: 700});
    

    All links will appear blue and the 2nd-level-links have fontWeight 700 until hovered, then they get fontWeight 200 set.

    If you switch the order

    Cufon.replace('ul li ul a',{hover: true, fontWeight: 700});
    Cufon.replace('ul li a',{hover: true, fontWeight: 200});
    

    Initially all links will have fontWeight 200, the 2nd-level-links will get 700 set when hovered.

    You notice the behavior changes depending on the order of your calls.


    Uncertainty

    I don’t know Cufon and I don’t really understand what you are trying to do. Especially I’m not sure if you mean to use the options passed in to Cufon as you do or if you actually mean to just set fontWeight when hovering.

    There is a difference between

    Cufon.replace('ul li a', { hover: true, fontWeight: 200 } );
    

    and

    Cufon.replace('ul li a', {
        hover: { fontWeight: 200 }
    });
    

    The first sets fontWeight to 200 and if the element is hovered also sets the fontWeight to 200, which would only be noticeable if the fontWeight changed in the meantime.

    The latter only changes the style of the element to fontWeight 200 while hovered and removes the weight when the element is no longer hovered.

    I’m not sure which one you intend to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 246k
  • Answers 246k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Something like this : select BookName from Book where BookId… May 13, 2026 at 8:24 am
  • Editorial Team
    Editorial Team added an answer There is no function called lower-case in XPath 1.0 which… May 13, 2026 at 8:24 am
  • Editorial Team
    Editorial Team added an answer There are two steps: You need to know how to… May 13, 2026 at 8:24 am

Related Questions

When using multiple lists and hover states the 'parent' Cufon style replaces the child.
When using powershell, sometimes I want to only display for example the name or
I have multiple drop down lists on a page. They all contain list of
I need to read a single file using multiple threads under Linux. There are
Given a scenario where we have multiple lists of pairs of items, for example:

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.