Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-20-2011, 02:16 AM   PM User | #1
listerdl
Regular Coder

 
Join Date: Mar 2011
Posts: 157
Thanks: 7
Thanked 0 Times in 0 Posts
listerdl is an unknown quantity at this point
Are too many closing </divs> bad?

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

<div>html code</div>

and then a lurking </div> - is this bad to have lurking there or will all browsers ignore an orphoned div tag?

Thanks
listerdl is offline   Reply With Quote
Old 04-20-2011, 02:24 AM   PM User | #2
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Having mismatched tags may or may not affect browsers atm but the code is invalid according to the w3c validator. Mismatched tags might cause web pages to break in future browser releases though.

If you use a reputable IDE like Netbeans 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.
bullant is offline   Reply With Quote
Old 04-20-2011, 07:03 AM   PM User | #3
hotelscyprus
New Coder

 
Join Date: Apr 2011
Posts: 15
Thanks: 0
Thanked 1 Time in 1 Post
hotelscyprus is an unknown quantity at this point
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.
hotelscyprus is offline   Reply With Quote
Old 04-20-2011, 08:56 AM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,614
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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).
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:27 AM.


Advertisement
Log in to turn off these ads.