Nesting <div> tags, good or bad?

liunx

Guest
I've been thinking about a few possiblities based on the idea that since every <div> tag can be given a background layer, it is possible to create multiple layers of images with text 'floating' on top, animated gifs with text over them and images under them... etc. to do this of course, requires nesting the div tags.

Is there an unspoken rule or standard, which defines any limits to this process. I know it's not a great idea to do it with tables.

for instance would this:

<div id="backgroundImage">
<div id="animatedLogoImage">
<div id="clippedThingFlyingAcrossTheScreen">
<div id="imageWhichLoadsUpLaterOn">
<div id="hiddenUntilMOver"><h1><a id="fade" href=http://www.webdeveloper.com/forum/archive/index.php/"#">WOW</a></h1>
</div>
</div>
</div>
</div>
</div>

.....be a bad idea.

If this kind of thing were OK I could basically make little flash movies (200px * 200px) using nothing but small animated gifs and some css.Well since <div> tags don't really mean much, I personally don't see a problem with using lots of them. However, if there was a limit to the number of nested <div>'s, you'd be pushing up against it. :p

If you can get away with using fewer tags then do, if not then no-one's going to hang you for it.OK thanks.

I'm sure if there are any problems with nested divs, I'll run into them sooner or later the way I code. :D I guess I was just worried about being semantically correct.... I wouldn't want it to slow down the page either.There's only two problems I can thing of:

1) Using a REALLY large amount of them might chug on the ol' band width (and I do mean LOTS. I doubt even 20 extra divs would have much (if any) impact).

2) With so many iterations of a nesting, any minor problems any browsers might have with this practice could become multiplied to a massive scale. For example you're going to have to position everything because as we all know, IE does a fantastic job of sticking a dil** right up the a*** of the css box model. So what would look fine in all browsers, if you allowed margins and padding handle the positioning naturally, would probably end up tripling the width of the page in IE.

There might be some other minor quirks in other browsers that might show up too. You'll just have to keep a close watch on how the page goes in each browser as you build. ;)

Hopefully everything should be fine. :DTo address this question from another angle, you might want to ask yourself, "Are all these layered images and special effects actually adding to the user-experience for the visitors to this site, are they simply 'because I can' features, or - worse yet - are they 'because I can' features which impede the usability of the site and degrade the user-experience by overloading the site's visitors with visual distractions?"

Remember, the purpose of any graphic effects in any communication medium is to aid the user in the assimilation of the content and purpose of the message, not to be the message.Originally posted by NogDog
'because I can' features which impede the usability of the siteI doubt that this will be the case, if you look then the code to users with JavaScript disabled will just be a header (albeit nested within a few <div>'s).

Mr Herer, good point about the magnification of browser quirks, I remember now that I had a similar problem on <!-- w --><a class="postlink" href="http://www.hackus.tk">www.hackus.tk</a><!-- w --> in IE. If you scroll down and then scroll up slowly the blue gap between the top of the main content area and it's title becomes white. A really weird bug but I never found out how to fix it.

IE deserves a slow painful death.Originally posted by lavalamp
I doubt that this will be the case, if you look then the code to users with JavaScript disabled will just be a header (albeit nested within a few <div>'s).

I wasn't even thinking about JavaScript- or browser-compatibility, simply the tendency of many to add various graphics and graphical effects to web pages which produce a "visual overload", bombarding the viewer with images and "cool toys" that ultimately serve only to distract the user from the actual purpose of the site (providing some sort of information or service) - or worse yet, to drive the user away. (For instance, if I go to a site that has animated GIFs flying across the window, chances are I'll move on quickly unless the site has some sort of "heroin content" that I just have to view.)Originally posted by NogDog
TRemember, the purpose of any graphic effects in any communication medium is to aid the user in the assimilation of the content and purpose of the message, not to be the message.

Well for the reasons you made in the post above, I do agree with that statement. However I can not agree with it completely. Saying that is rather like saying the internet is for data only. That art is not welcome on the web. I don't think an alt attribute would quite cut it with regards to the Mona Lisa, however on the web, it's about the best one can expect. Is she not welcome on the web simply because her best qualities can not be understood by machines?Originally posted by Mr Herer
Well for the reasons you made in the post above, I do agree with that statement. However I can not agree with it completely. Saying that is rather like saying the internet is for data only. That art is not welcome on the web. I don't think an alt attribute would quite cut it with regards to the Mona Lisa, however on the web, it's about the best one can expect. Is she not welcome on the web simply because her best qualities can not be understood by machines?
No argumet from me: there are sites where visual art, mutlimedia, etc. are the message, and therefore it is very likely that certain visual images, animations, special effects, etc. will, in fact, add to the site's message.

If I were a Flash programmer (I'm not) creating a personal business site to sell myself as such, you can bet I'd have some nifty Flash visual effects (hopefully artistic and tasteful) included in order to demonstrate my expertise. If I were a skilled artist (I'm not) working in the field of animation and wanted to create an on-line gallery of some of my work, you can be sure I would use animations on my site.

What I'm hoping to encourage people to avoid is using Flash, animations, scrolling marquees, rollovers, etc. simply because they can, not because those tools/effects actually add anything to (and possibly subtract from) the message they want to communicate; whether that message is "Buy this", "Vote for [insert candidate]", or "I like dogs, do you?".Originally posted by Mr Herer
With so many iterations of a nesting, any minor problems any browsers might have with this practice could become multiplied to a massive scale.

damn straight.

Originally posted by Mr Herer
For example you're going to have to position everything because as we all know, IE does a fantastic job of sticking a dil** right up the a*** of the css box model. So what would look fine in all browsers, if you allowed margins and padding handle the positioning naturally, would probably end up tripling the width of the page in IE.

There are always issues. But buy simply adding a few CSS statements, float and margin issues can disappear. But positioning, I try to avoid.

Originally posted by Mr Herer
There might be some other minor quirks in other browsers that might show up too. You'll just have to keep a close watch on how the page goes in each browser as you build. ;)

Meh, design in a standards compliant browser first, then fix IE bugs.

Originally posted by Mr Herer
I don't think an alt attribute would quite cut it with regards to the Mona Lisa, however on the web, it's about the best one can expect.

That's why we have the longdesc attribute.
;) :D :pCheers for the numerous replies.

Nog, I agree with you. I wouldn't want the animations or graphics to distract from the purpose of the site. The site in qusetion is infact my "mucking around with various experiments site", so there's no danger of distracting from the important information as there isn't any.

On the one hand I do think it's important to test the boundaries of what I have learned, so the "because-I-can" theory, if confined to such experimental sites is actually quite important to me. I hope I have taste which falls within the normal confines of internet society, but it's nice to f*** it all just once in a while and do stupid things on secret, pointless websites :DOriginally posted by bol
...The site in qusetion is infact my "mucking around with various experiments site",...
Ahhh..., my favorite kind of site. Go for it! :)
 
Back
Top