CSS link target

Reply

Join Date: Oct 2006
Posts: 201
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

CSS link target

 
0
  #1
Jan 12th, 2007
Hi all,

How do I make a link with the class of "externallink" open in a new window using css? Here is my current style for "externallink" class:

HTML and CSS Syntax (Toggle Plain Text)
  1. a.externallink:link {
  2. color: #FF99FF;
  3. text-decoration: none;
  4. }

Thanks!!

Max. :cheesy:
Last edited by MaxMumford; Jan 12th, 2007 at 2:05 pm. Reason: forgot to take out the test bit of the css: target: _blank - it didnt work
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: CSS link target

 
0
  #2
Jan 12th, 2007
http://www.w3.org/TR/css3-hyperlinks/

god only knows which browsers are using CSS3 yet; and even then, I wouldn't rely on it working until everyone's upgraded all of their browsers.

I stick with IE6; and I have no plans to change that on dev workstations until it isn't the most common browser for users...
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 201
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: CSS link target

 
0
  #3
Jan 12th, 2007
ok thanks. ill put the code in anyway. do you know it?
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: CSS link target

 
0
  #4
Jan 12th, 2007
did you see the link in that post?

i guess it would be something like:

HTML and CSS Syntax (Toggle Plain Text)
  1. a.externallink:link {
  2. target-name: new;
  3. target-new: window;
  4. }

or (exclusive)...

HTML and CSS Syntax (Toggle Plain Text)
  1. a.externallink:link {
  2. target: new window;
  3. }

the stuff outlined at that location (http://www.w3.org/TR/css3-hyperlinks/) is a working draft... that means it isn't necessarily going to end up like that in the official CSS3 spec when it's done.

personally, i'd stick with the target='_blank' or target='<string>' method until/unless that spec is implemented in at least one popular browser...
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: CSS link target

 
0
  #5
Jan 12th, 2007
i imagine that you wouldn't need the :link psuedoclass on that selector when/if it is implemented.. so it'll just be:

a.externallink{...}
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 201
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: CSS link target

 
0
  #6
Jan 12th, 2007
ok cool thanks so if i just put

a.externallink {
target-name: new;
target-new: window;
}

will that style it for a:link a:hover a:visited and a:active? also, can i put a:externallink:link etc after it and the open in new window script and styles will work with it?


Max.
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: CSS link target

 
0
  #7
Jan 13th, 2007
Well. All style rules for the class a.externallink will be applied during the 'pseudoclass states' (a.externallink:link a.externallink:hover a.externallink:active and a.externallink:visited) unless style rules defined for those pseudoclasses overide rules defined for the class.

Putting the definition for CSS3 target properties in a pseudoclass might cause seemingly erratic behaviour; I don't know whether a:link and a:visited are mutually exclusive... if they are, and you put the definition in :link, then your links would only open in a new window the first time they are visited.

I don't know whether the :hover state is dropped when a link is clicked: If it is, and you put the link in :hover or :active; your links would only open in a new window until they are clicked... i.e. never =P
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 201
Reputation: MaxMumford is an unknown quantity at this point 
Solved Threads: 2
MaxMumford's Avatar
MaxMumford MaxMumford is offline Offline
Posting Whiz in Training

Re: CSS link target

 
0
  #8
Jan 13th, 2007
lol ok to be honest ill just manually make the link's targets _blank Thanks a lot though.. learned a lot
Ill solve somebody's thread someday! xD
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC