jwermont Posted March 4, 2006 Share Posted March 4, 2006 I have a simple file that almost passes HTML 4.01 Strict validation, except for two errors: two closing paragraph tags that are flagged as 'end tag for element "P" which is not open.'The tags are like so: <p class="outer paragraph"> <p class="inner"> Stuff.... </p> <p class="inner"> More stuff.... </p> </p> It's the final </p> that's caught as an error. (I got two errors because there was another piece of the code similarly structured.)The close tags for the inner paragraphs were not flagged as errors. When I removed the two outer close tags, the page validated.Here are the real pages:http://home.sonic.net/~jwermont/portfolio/...v/samples2.html - doesn't passhttp://home.sonic.net/~jwermont/portfolio/...ev/samples.html - passesI don't understand this. Doesn't HTML 4.01 require close tags for all tags? Are nested paragraphs not allowed? Is there a bug in the validation? Could somebody explain this?Thanks!Joyce Link to comment Share on other sites More sharing options...
vchris Posted March 4, 2006 Share Posted March 4, 2006 It is illegal to have a <p> within a <p> tag.Code should be: <p class="inner"> Stuff.... </p> <p class="inner"> More stuff.... </p> Or <div class="outerparagraph"> <p class="inner"> Stuff.... </p> <p class="inner"> More stuff.... </p> </div> Link to comment Share on other sites More sharing options...
Agustine Posted March 4, 2006 Share Posted March 4, 2006 You know I was just going to say the same thing. I've never seen a <p> in a <p> before. Link to comment Share on other sites More sharing options...
vchris Posted March 4, 2006 Share Posted March 4, 2006 me either hehe... Link to comment Share on other sites More sharing options...
jwermont Posted March 4, 2006 Author Share Posted March 4, 2006 It is illegal to have a <p> within a <p> tag.I didn't realize that! (Obviously. )It works fine, as far as the appearance of the page is concerned.I can change it to a <div>, though, no problem there. Can you have nested <div>'s?Thanks,Joyce Link to comment Share on other sites More sharing options...
vchris Posted March 4, 2006 Share Posted March 4, 2006 Yes as much as you want! Link to comment Share on other sites More sharing options...
Jonas Posted March 4, 2006 Share Posted March 4, 2006 You could also use <span> I think.The differance is <div> displays as block-level element, <span> inline I think. Link to comment Share on other sites More sharing options...
vchris Posted March 5, 2006 Share Posted March 5, 2006 spans are mostly for text sections. Making a certain part of the text a different color. Spans are not as powerful as divs. Link to comment Share on other sites More sharing options...
mpoer Posted March 5, 2006 Share Posted March 5, 2006 you guys are all exactly correct :)i'll just add that spans can be used for a small amount of text, but you can't nest them within each other.divs have ultimate nestability Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now