質問

validator.w3.org considers the following valid HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <title>Test</title>
 </head>
 <body>
  <div>This <<<<<<<<<<<<<<<<<<<<<<b>is</b> a test.</div>
 </body>
</html>

Is it really valid?

役に立ちましたか?

解決

Yes, the tag would just be treated as additional text. It's not part of the HTML tag.

It'd just print

This <<<<<<<<<<<<<<<<<<<<<is a test.

Nothing wrong with that.

他のヒント

This code is successfully verified using the W3C Validator. And the page will be shown on all major browsers (Firefox, Opera, Chrome and Internet Explorer) as expected.

You can check the result here: http://validator.w3.org/

When validating as HTML it is allowed, but not when validating as XHTML.

Here you need to use &lt; and &gt;, which is best practise anyway.

I tested your code in w3c. It's perfectly valid according to w3c standard :)

But it's always a good practice to work with HTML entities. You can write "<" or "<" in spite of writing ">". We use HTML entities to ensure exact result for all browsers and platforms. Reference:http://www.w3schools.com/html/html_entities.asp

Best Regards, Touhid

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top