View Full Version : Are too many closing </divs> bad?
04-20-2011, 03:16 AM
Hi just curious is it is bad to have an extra closing </div> in your code?
I have a page that has many divs and it is such a headache trying to work out which one relates to which tag...
So I mean
and then a lurking </div> - is this bad to have lurking there or will all browsers ignore an orphoned div tag?
04-20-2011, 03:24 AM
Having mismatched tags may or may not affect browsers atm but the code is invalid according to the w3c validator. (http://validator.w3.org/) Mismatched tags might cause web pages to break in future browser releases though.
If you use a reputable IDE like Netbeans (http://netbeans.org/)or something similar, it indents all your code for you which makes it much easier to spot mismatched tags. Also if you click on a tag, it will highlight its matching tag if it exists.
04-20-2011, 08:03 AM
If you use too many hidden <div> and <span> its really bad and affects in SEO. Other than that..I don't think its a wrong use.
04-20-2011, 09:56 AM
You can’t expect cross browser consistent results with erroneous code – that that’s what redundant closing tags is. You should always format your code properly when writing it (i. e. indent and maybe comment it to remember what is where).
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.