Connecting Tech Pros Worldwide Forums | Help | Site Map

Can I define the target property of <a> with CSS?

mikek12004's Avatar
Familiar Sight
 
Join Date: Sep 2008
Location: Athens, Greece
Posts: 188
#1: May 8 '09
Supose you want to make sure that its link on your websites open in the same browser window not a new one, in HTML you would have inside every a tag to define target='_self' for every link does CSS has any such property for me to avoid all thia trouble?

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#2: May 8 '09

re: Can I define the target property of <a> with CSS?


Quote:

Originally Posted by mikek12004 View Post

…, in HTML you would have inside every a tag to define target='_self' for every link

well, usually this is default behaviour (at least when using relative paths, I think). further, target is not allowed in the strict doctype html variants.

and of course you can tweak you favourite browser to open the link target where you want ;)

Quote:

Originally Posted by mikek12004 View Post

does CSS has any such property for me to avoid all thia trouble?

nope, CSS deals with layout (how the browser displays your page)
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: May 9 '09

re: Can I define the target property of <a> with CSS?


If you must do this for whatever reason, it'd usually be to try to ensure it opens in a new window (unless someone tweaks their browser), then you could use JavaScript to set the property of each link.
Reply