Member Avatar for diafol

Hmm. I always try to stay clear of inline styles and presentational classitis:

<div id="my_id">
 ...
</div>
<br />

and

#my_id + br{
 clear:both;
}

Would be my take if the previous tag (container) had an id. Perhaps that's being a bit anal, but I try to hide all the complexity inside CSS.

almostbob commented: rereading and just noticed this snippet properly, my css file, its about half the size, even without Mod_gzip +4

Technically there is little difference between the 2 - both are block-level elements so you could basically manipulate them in the same way, with CSS, nesting or otherwise.

Table vs div on image stealing? Again they're both the same. If a user can see it he can make a copy too. That's where JavaScript, or pre-serve watermarking come in to play.

The difference between the two is semantics. The meaning of the element.

A table should be used to show tabular contents, for example data showing a list of supported features on a page comparing different versions of a software product.

A div should be used to show a "page division" i.e. a site's header, left/right columns and a footer.

The reasons the argument still rages on:

- It's simply two different schools of thought
- Browser compatibility

The "old school" designers have tended to use tables, because of browser compatibility. Divs, implying page structure, were interpreted differently by the early browsers.

As divs should semantically be used and because of improved browser standards-compliance, more recent designers (or those who didn't learn "old-school") use divs.

So if you are looking to decide between the two, use divs for page structure, and tables for tabular data. It'll mean more to any parsers (i.e. crawlers) so your page will reflect better in seo and will be more helpful for mobile browsers, and by avoiding inline-css and having more freedom with selectors you may even reduce your file size too.

Simples :)

Member Avatar for diafol

I think you'll find that DIVs will enable flexibility via css swapping and accessibility issues. As for 2 schools of thought - I don't buy that. Tables are for data - Simples. If you use tables for layout, IMO, you're either lazy or a poor web designer.

exactly lol, thankfully these days it's rare to find an "old-school" designer.

exactly lol, thankfully these days it's rare to find an "old-school" designer.

unfortunately, it's too easy to find stubborn old-styled clients *sigh*

I was very glad that I found this topic, it really helped me answer my questions, it really made me a confusion. I would say that I am a tables man. really helped me a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.