Previous Message
Next Message

Re: [css-d] A Question.

Sent by Eric A. Meyer on 2 January 2003 15:03


At 2:29 -0200 1/2/03, Caio Chassot wrote:

>You can, however, create a bookmarklet to add this [link underlining]
>rule to a site stylesheet, and click it whenever you need.

    As we once more lightly trip along that line between CSS and 
Javascript...  Here's the favelet[1] I created[2] back in early 
October, specifically because one site I often visit sets their link 
text to be the same color as their regular text, and I refuse to 
enable link underlining in my primary browser[3].  I have the favelet 
in my personal toolbar as _a_ :

javascript:o=document.getElementsByTagName('a');for(i=0;i<o.length;i++ 
){o[i].style.textDecoration='underline';};void(20021009);

Note that invoking this bit of Javascript will alter the document's 
styles to underline[4] ALL 'a' elements, including non-link <a 
name="blah">...</a>.  It would be possible to write a function that 
only underlines 'a' elements with an 'href' attribute, but I was 
feeling lazy.  It will also leave the underlines until the page is 
reloaded.  It would probably be possible to write a favelet that 
toggled them back and forth with each click, but again-- I'm lazy.  I 
find the above works well enough for my purposes.


[1] I prefer the term "favelet" to "bookmarklet," but no reason to 
make anything out of that.  Just my personal preference.
[2] I probably adapted it from the table/td-highlight favelet I got 
from someone else, though now I can't remember who it was.
[3] Because I think the underlines are ugly.  It's another matter of 
personal preference.
[4] Of course, any other style change(s) could be made to the 
elements.  I considered boldfacing all links instead of underlining 
them but didn't want to risk document reflow problems that might 
result.  It also wouldn't have helped with making inline images in 
links stand out, which underlining should do.

--
Eric A. Meyer (http://www.meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
   -- Martina Kosloff (http://www.mako4css.com/)
Previous Message
Next Message

Message thread:

Possibly related: