문제

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