Forum Moderators: open

Message Too Old, No Replies

Using target attribute on <a href...> with XHTML

Is there an alternative?

         

irotte

1:53 pm on Mar 5, 2004 (gmt 0)

10+ Year Member



I use this type of code on many pages of my site:
<a href="www.otherdomain.com" target="_blank">
blablabla
</a>

W3C validation says that it is not valid XHTML 1.0. I use strict XHTML like this:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Is there a good alternative to have the same type of result? Maybe with CSS?

Mohamed_E

2:02 pm on Mar 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See tedster's response (msg #8) in this thread: [webmasterworld.com...]

encyclo

2:48 pm on Mar 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tedster's reply is excellent, as usual. I would add this, however: if you want to use deprecated elements such as target="_blank" and still validate, you should be using a Transitional doctype rather than a strict one. In the case of XHTML, you can use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If you want to use a strict doctype, then you need to accept the constraints of the specification. It's your choice - an invalid XHTML Strict page, a valid XHTML Strict page full of javascript hacks whose only meaning is to pass the validation process, or a clean, valid XHTML Transitional page.