Topic: [CSS] Link border problem |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: |
posted 11-01-2005 16:40
I am working on a page in which I must have the css wrong but it actually gives the intended effect in IE. Mozilla and Opera 8 display it pretty much the same which makes me think my css must be wrong. code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body{background:#666} a{display:block;width:42px;border:2px outset #a9a9a9} a:hover{border:#c0c0c0} a:active{border:inset} </style> </head> <body> <p><a href="#">foobar</a></p> </body> </html>
|
Paranoid (IV) Inmate From: France |
posted 11-01-2005 16:47 |
Bipolar (III) Inmate From: |
posted 11-01-2005 16:54
Yikes! That solved part of the problem but how do I get the border to remain inset until something else is clicked? I'd rather not script the behavior if I can accomplish it using css. |
Paranoid (IV) Inmate From: France |
posted 11-01-2005 17:15 |
Bipolar (III) Inmate From: |
posted 11-01-2005 18:11
Thanks. I should have mentioned I tried that. It doesn't work in Opera but it does work in Mozilla for the example I posted. Unfortunately it does not work in my production page which is built dynamically. Any other ideas? Opera I'm not so worried about but there are a significant number of Firefox users here so I'd like their experience to be consistant with IE users as much as possible. |
Paranoid (IV) Inmate From: France |
posted 11-01-2005 18:37
Is the focus moved from elements to elements on your production page ? could you share a consistent example of page, because it should work. |
Bipolar (III) Inmate From: |
posted 11-02-2005 07:37
Aside from much of the data in the page being proprietary it would be a lot of work to cull out a working example. Yes the markup is valid XHTML 1.0 Strict. The CSS isn't valid due to a few proprietary MS attributes (removing them didn't solve the problem) but apart from those I only had a few warnings about fonts and background colors. code: function bInset(ob) { if (Mozilla) { ob.style.borderStyle='inset'; if (bCache) D.getElementById(bCache).style.borderStyle='outset'; bCache=ob.id; } }
|
Paranoid (IV) Inmate From: France |
posted 11-02-2005 09:43
To avoid maintenace problems you should opt for something less obstrusive, in the vain of the accessible popups, and use some CSS class instead of hardcoding the style. |
Bipolar (III) Inmate From: |
posted 11-02-2005 16:16
We aren't using popups. This page is a directory of regional managers for several states. Clicking the links in the left margin displays contact info in an adjacent div. Presumably the original author used links precisely to avoid hardcoding styles by making the :hover pseudoclass available to IE. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 11-02-2005 20:04
I think what poi is suggesting is that as opposed to putting code in each link you should dynamically add the onmouseover actions based on class name. This takes the functionality away from the individual links and allows you to add it to the class. |
Paranoid (IV) Inmate From: France |
posted 11-03-2005 19:06 |