Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If you set the target attribute on a element it won't validate at http://validator.w3.org how doe one come around this and still have it validating?

share|improve this question
    
Best to ask at doctype.com ? –  Iain Jan 8 '10 at 13:19
    
You can have a target element, or you can have valid code. Not both - for a good reason. But if it renders, it renders, right? –  Phoshi Jan 8 '10 at 15:08

3 Answers 3

up vote 1 down vote accepted

The target attribute is still part of the HTML 4.01 standard (and works in all browsers), but it is no longer part of XHTML (which you are probably trying to validate for). There is currently no HTML-way to emulate its effect.

There is the CSS3 Hyperlink Presentation Module draft however, that would bring back such a possibility via CSS. However it is currently not implemented by any browser.

share|improve this answer
    
XHTML1.0 is semantically the same as HTML4, just expressed as XML instead of SGML. There is (almost) no difference in what elements and attributes are allowed. target is as valid in XHTML as HTML (that is to say, it can be valid or invalid depending on whether you're using Strict or not). –  bobince Jan 8 '10 at 21:45

<a target> is perfectly valid in HTML 4.01 Transitional and XHTML 1.0 Transitional. If you must use frame-targetting, you'll need to use one of those DOCTYPEs.

share|improve this answer

You can't use target in valid XHTML.

Here's a way to emulate its effect using valid xhtml with a small snippet of javascript: http://snippets.dzone.com/posts/show/4074

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.