I know that I can use <a href="URL" target="_blank"> to open a link in new window. But is there any way that I can do it in CSS? example: Link is <a href="URL"> </a>..can I add something in CSS so all links open in new window instead of changing every <a> tag.
CSS is just a style sheet... you could do it, but it'd be a waste of time... how come you don't want to use the "_blank" for the target?
No, it's a html attribute. Try using something like notepad++ so that you can do a find and replace to add that to all hrefs.
There is no way to do it in CSS and the (X)HTML way is not valid code. You could do it via JavaScript, but I'd still try and stay away from it as much as possible.
you can use:- <a href="link" target="blank">anchor text</a> there should not be a _ this may damage the link to open in a new window.
I want to do it for the link codes I get from advertisers. I am not sure if I can change their code...thats why.
Completely agree with "djzmo", there is always a JS solution; weather its a small or big fix, but it works. You will have to get that custom JS made to work according to your wish.
You can't do it in CSS. It's really okay to do it through '"target="_blank"'... But if you don't want it that way, you can do it through JS.
I wouldn't worry about changing it purely on the fact that the advertisers may not like it as I am sure most will expect you to use it in the first place.
Nah, its not that. Just throw this in your <head>, and it changes for all links, unless otherwise specified. Though opening links in new Windows is very annoying. <base target="_blank" /> Code (markup): Won't validate strictly though.
I think target="_blank" is the easiest way to do it. Why make it complex with JS? You don't want your readers to leave your web page so, you want to open the advertiser's links in a new window/tab. But I think, if your readers want to stay on your web page (if they find what they are looking for) and don't want to leave your site, they will find a way to open the link in new window. If not, they will anyways come back to your web page.
Brilliantly says. Every modern browser comes with a "Open in New Window" or "Open in New Tab" nowadays. IE's popup blocker goes insane with new windows, as well.