Aleksandr Ivanov
Aleksandr Ivanov

Reputation: 2786

Can't set anchor tag to [disabled] in IE

I have the following css code. button.png is image where 3 button states are pasted vetrically, so i just move image in css.

a.button
{
    background-image: url(button.png);
    background-position: 0px 0px;
    width: 100px;                                            
    height: 30px;
    display: block;
    background-repeat: no-repeat;
    text-indent: -9999px;
}
a:hover.button
{
    background-position: -100px 0px;
}
a.button[disabled]
{
    background-position: -200px 0px;
    cursor:default;
}

I put this in html

<a href="#" class="button" disabled="disabled"></a>

In Chrome all is ok. IE dont show disabled image.

Upvotes: 0

Views: 2220

Answers (3)

Mex
Mex

Reputation: 508

If you can assume your users will have javascript on you can use ie7.js to provide the missing selectors http://dean.edwards.name/IE7/

Upvotes: 0

matpol
matpol

Reputation: 3074

What IE - attribute selectors are not supported in IE6 and you need a doctype in the others.

Upvotes: 0

Pekka
Pekka

Reputation: 449813

IE 6 can't handle attribute selectors. Source

IE 7 and 8 should be able to handle a.button[disabled=disabled] though.

For full compatibility, you would have to add a class to the disabled button:

a.button[disabled],
a.disabled
{
...
}

<a href="#" class="button disabled" disabled="disabled"></a>

Upvotes: 1

Related Questions