Isaiah 40:31 Posted September 23, 2008 Share Posted September 23, 2008 Going through the w3schools tutorials, and it mentions that a space should be used in the closing tags between the / and the tag. However when I go to validate it through http://validator.w3.org it generates errors.If you look at the text below I have "</ strong>" with a space and it will fail validation. Remove the space and it passes validation? What's wrong? <?xml version="1.0" encoding="UTF-8"?><!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" xml:lang="en" lang="en"><head><title>test3</title></head><body><p>a simple paragraph</p><p><strong>Bold Text</ strong></p></body></html> Link to comment Share on other sites More sharing options...
jlhaslip Posted September 23, 2008 Share Posted September 23, 2008 you can safely remove the xml prologue from the first line of your sample page.It isn't required by the w3c, and will throw some Browsers into Quirks mode. (IE)Might be a problem with you using an xhtml Doc Type. The xhtml pages are stricter in their coding. Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted September 23, 2008 Share Posted September 23, 2008 It means that elements with a self-closing tag should have a space. Here are the most common self-closing elements: <br /><img src="blah.html" alt="Blah" /><hr /><param name="blah" value="blah" /><meta name="language" value="en-CA" /><base href="http://127.0.0.1/" /><colgroup id="rank" /> Notice the space before the slash.It doesn't mean put a space between the slash and the tag name. For example: </ kbd> is wrong, </kbd> is right. Link to comment Share on other sites More sharing options...
Isaiah 40:31 Posted September 23, 2008 Author Share Posted September 23, 2008 Thank you for your responses.jlhaslip, are you referring to this:<?xml version="1.0" encoding="UTF-8"?>or something else? Link to comment Share on other sites More sharing options...
Synook Posted September 23, 2008 Share Posted September 23, 2008 There should be no space. Are you sure you read the tutorial correctly? If the tag is empty then there can be one, e.g. <img /> and <img/> are both fine, but in other cases the forward slash should immediately followed by the tag's name.Edit: Oops, I didn't read FireFockRocks's post Link to comment Share on other sites More sharing options...
jlhaslip Posted September 23, 2008 Share Posted September 23, 2008 Thank you for your responses.jlhaslip, are you referring to this:<?xml version="1.0" encoding="UTF-8"?>or something else?That's it... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.