View Full Version : "target" attribute and "Strict" document type

Jul 6th, 2010, 07:24 PM
Hi All,

Quick question I hope!

I get the error below when checking site on http://validator.w3.org/

my document type is W3C//DTD XHTML 1.0 Strict and I'm using a "target" attribute. (to open a new window to confirm email address for feedburner)

Is this error anything to worry about?

Should I change my document type to transitional? (I don't really understand the difference between the two and why you should chose one over the other).

thank you


there is no attribute "target"
…t-align:center;" method="post" target="_blank" action="http://feedburner.googl…

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

Jul 6th, 2010, 09:01 PM
target is only used for framesets in strict mode. If you want to create a pop-up, you should use javascript, not target. The reasoning behind this is that creating a pop-up is a behavioral, not a structural, property. Markup is for structure, javascript is for behavior.

Jul 6th, 2010, 09:04 PM
thank you, I was just starting to think that, I'll re-post in the JavaScript forum for further help.


Jul 7th, 2010, 02:06 PM
thank you, I was just starting to think that, I'll re-post in the JavaScript forum for further help.

No! You shouldn't cross post your issue in multiple forums as it's against forums rules. Instead, just request a moderator to move it to the right place (you may even use the report button).

Now, to your query, take a look at http://www.codingforums.com/showthread.php?t=152574, especially _Aero_'s reply.

Dec 26th, 2012, 09:01 PM
sorry for coming back here, but i dont understand very much these codes
how can i fix this

(you must use the "Transitional" document type to get the "target" attribute)

I use thiw instead

on my www.elgreko.gr

Thanks and sory for my english

Dec 26th, 2012, 09:36 PM
target is ONLY valid in HTML 3.2 - it was deleted from HTML 4 so as to improve visitor experience by giving a greater choice. So to use it with any HTML 4 tags you MUST specify that the page is still transitioning from HTML 3.2. To complete the transition to HTML 4 you would remove the target attributes completely and let your visitors choose what opens in a new tab and what opens in a new window. Those more familiar with how their browser works will have it set to ignore the target attribute and open pages where they want them to anyway.

Dec 26th, 2012, 09:49 PM
oh yes you give me a good point, i was checkin this for 2 days without finding
a solution, i wil remove the target atributes.. hope all will be ok

and some last question please, if i want to include an icon lets say for Twitter
what code is better, can you please write one here

Thanks for your answer