Are Nested Span Tags Ok in Xhtml

Are nested span tags OK in XHTML?

Yes it will. You can help yourself by using the w3's validator direct input option:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Title</title>
</head>

<body>
<p>
<span>Test<span>Nest span</span></span>
</p>
</body>
</html>

Can there be two span tags with one span close tag

You are correct.

Each span tag should have its own closing tag.

The fact that a browser might handle this error doesn't make it OK.

HTML span tag question

Yes you can. That is valid html :) You can check with W3C Validator.

Nested rounded border graphic over text within span/span tags?

You can do that

span{    display:inline-block;}
span:first-child{ border:1px solid black; border-radius:15px; padding:10px;}span:last-child{ border:1px solid black; border-radius:15px; padding:10px;}
<span>She <span>loves</span> him a <span>lot</span>.</span>

Is an XHTML doc nested inside an XHTML doc invalid?

Of course it's not valid to embed one (unescaped) XHTML document within another one.

But if you have no choice but to take content from one complete XHTML document and insert it into another, there might be a simple way of merging the two. For example, you could just take the contents of the <body></body> tags and discard everything else. Or if there are other things (such as stylesheets) that are required from the document, extract these from the document and merge them into the <head></head> of the master document.



Related Topics



Leave a reply



Submit