![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I wanted to visually indicate which links are internal to my site, and which are external. I also wanted to indicate whether any links used a less common protocol on the web, such as ftp (not sure there are any other I am likely to encounter). Targeting the first term in the link with an attribute selector seems to work (in browsers supporting it). /* Style our links with special colour for external or ftp */ a:link {color: #00ff00;} a[href^="http://"] {color: #8888ff; } a[href^="https://"] {color: #8888ff; } a[href^="ftp://"] {color: #880000; } a:visited {color: #4444cc;} a:hover {color: #0000ff;} a:active {color: #ff0000;} What I can not figure out is how I could extend this sort of scheme to allow an alternate but similar set of visual indications to the type of visited links. Any suggestions? |
#3
| |||
| |||
|
|
a[href^="http://"] {color: #8888ff; } |
|
What I can not figure out is how I could extend this sort of scheme to allow an alternate but similar set of visual indications to the type of visited links. Any suggestions? |
#4
| |||
| |||
|
|
Am 20.01.2009, 23:50 Uhr, schrieb Eric Lindsay NOwebmasterSPAM (AT) ericlindsay (DOT) com>: a[href^="http://"] {color: #8888ff; } […] What I can not figure out is how I could extend this sort of scheme to allow an alternate but similar set of visual indications to the type of visited links. Any suggestions? You may combine attribute selectors with pseudo classes: a[href^="http://"]:visited {color: #4488ff; } |
#5
| |||
| |||
|
|
On Tuesday 20 January 2009 23:50, Eric Lindsay wrote: I wanted to visually indicate which links are internal to my site, and which are external. I also wanted to indicate whether any links used a less common protocol on the web, such as ftp (not sure there are any other I am likely to encounter). Targeting the first term in the link with an attribute selector seems to work (in browsers supporting it). /* Style our links with special colour for external or ftp */ a:link {color: #00ff00;} a[href^="http://"] {color: #8888ff; } a[href^="https://"] {color: #8888ff; } a[href^="ftp://"] {color: #880000; } a:visited {color: #4444cc;} a:hover {color: #0000ff;} a:active {color: #ff0000;} What I can not figure out is how I could extend this sort of scheme to allow an alternate but similar set of visual indications to the type of visited links. Any suggestions? Do you have to parse it automatically? Anything against giving your links themselves a class in the HTML (<a class="external" href="whatever">) and styling that class? |
![]() |
| Thread Tools | |
| Display Modes | |
| |