Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member TheGardener's Avatar
    Join Date
    Jun 2006
    Posts
    62
    Member #
    13332
    Hello,

    I'm trying to use CSS that looks like this:

    Code:
    #navigation a[title="Home"] {
        width: 85px;
        background-image: url(./images/navTabHome.gif);
    }
    
    #navigation a[title="Home"]:hover {
        background-image: url(./images/navTabHomeOn.gif);
    }
    
    #navigation a[title="My Work"] {
        width: 103px;
        background-image: url(./images/navTabMyWork.gif);
    }
    
    #navigation a[title="My Work"]:hover {
        background-image: url(./images/navTabMyWorkOn.gif);
    }
    But IE chokes on it. It appears that IE doesn't like the title specification. Is there any way that I can make IE reference an element by its title? This is for a Wordpress theme, so referencing the element by class or id isn't really practical. Thanks.

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    In fact, you can't use any of the attribute matchers in IE. The only semi-good way to do this would be to apply it as you did above, but also to a certain class (say, my_work_title). Then, at runtime, on load, run some code that will add that class if that title element is there. It should be relatively simple to achieve with Prototype, for example:

    Code:
    document.observe('dom:loaded', function() {
      $$('#navigation a[title="Home"]').each(function(elt) { elt.addClassName('navigation_home'); });
    
      $$('#navigation a[title="My Work"]').each(function(elt) { elt.addClassName('navigation_work'); });
    });
    Or, the jQuery variant:

    Code:
    $(document).ready(function() {
      $('#navigation a[title="Home"]').addClass('navigation_home');
      $('#navigation a[title="My Work"]').addClass('navigation_work');
    });

  4. #3
    Member TheGardener's Avatar
    Join Date
    Jun 2006
    Posts
    62
    Member #
    13332
    Thanks, Shadowfiend. Makes sense that IE wouldn't implement a CSS 2.1 feature. I figured out how to reference the elements by their regular class values, but now the styles aren't working right -- see my other thread for details...


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 07:07 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com