Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DIV or Tables?

Featured Replies

Divs are for layout, Tables are for tabular data. So you can't really compare one with the other, yes some people do use tables for layouts but really they shouldn't as its not good idea for many reasons ;)

  • Author
table less is robot friendly for SEO

 

 

Oh, cool, But one thing that I don't understand on divs is how you align them to differnet pars and things like that

It's not DIVs or tables, it's semantic HTML or tables. (sorry really picky I know).

 

Either way it should be the right HTML element for the right purpose. i.e.: if you want to represent a paragraph of information, you use the <p> element. If you want to represent tabular data then use tables. If you want to wrap a load of HTML together and style it or move it around your use a <div>.

As a bad-HTML writer, I do everything with tables, I go;

 

a ) Make website in Photoshop

 

b ) Slice website in Photoshop

 

c ) Save website 'for web', producing an index.html

 

d ) Tidy it up :)

 

I think actually, in honour of this topic, I'm going to go learn how to code a div website :)

As a bad-HTML writer, I do everything with tables, I go;

 

a ) Make website in Photoshop

 

b ) Slice website in Photoshop

 

c ) Save website 'for web', producing an index.html

 

d ) Tidy it up :)

 

I think actually, in honour of this topic, I'm going to go learn how to code a div website :)

Beware not to catch divius. SPANs and DIVs got no semantic meaning, so use them as a last resort and use the other elements availible in the Strict doctype. Also, class="red" is just as bad semantics as <b> so keep your classes related to the content, not by what you intend their visual appearance will be.

 

Sorry if you allready know this, but it's something often seen when people move from table layout to pure CSS layout. I did.

  • 3 weeks later...
  • 4 weeks later...
if you want to represent a paragraph of information, you use the <p> element.

 

Which is better practice? :

 

To use <p> and </p> to wrap paragraphs of text

 

OR :

 

to use <br><br> tags between the "paragraphs" to produce the same effect?

<p> tags are for containing paragraphs of text. If it's a paragragh then using a <p> tag is applicable. <br /> is only used when you actually need a line break in a document.

I use a mixture of both - but mainly DIVS :0)

Divs.

 

They're much more semantic. They use much less markup. They help my markup be POSH. And they're just generally more uber than tables.

First off read this.

 

If that does not convince you that tables are bad and semantic HTML is good (as opposed to DIVS), then go away and read this, then this.

Which is better practice? :

 

To use <p> and </p> to wrap paragraphs of text

 

OR :

 

to use <br><br> tags between the "paragraphs" to produce the same effect?

 

Use a <p> add the content and close it with a</p>. When a paragraph ends and another one starts you use another <p>. Rinse and repeat.

 

Never use <br /> for doing what the code is already in place for.

Cheers! Thought you might say that! I've got some tidying up to do!

Like many have said above, tables should only be used for tabular or gridded data. Everything else should be coded in semantic HTML with CSS styling. Never use tables for anything else (like an entire page), you're just asking for trouble!

 

Rob

Divs are for layout, Tables are for tabular data...

 

Well put, any web designer of rank uses XHTML Strict, DIV's and CSS to manage styles and layout ;)

Well put, any web designer of rank uses XHTML Strict, DIV's and CSS to manage styles and layout ;)

 

I dispute the use of XHTML strict as it's features aren't supported by the majority of browsers (ie. You won't see the benefits of the XML functionality), but definitely a strict doctype for sure! ^_^

I dispute the use of XHTML strict as it's features aren't supported by the majority of browsers (ie. You won't see the benefits of the XML functionality), but definitely a strict doctype for sure! ^_^

With the exception that you can use a simple XML parser to traverse the document. Good for when you have small lightweight applications that access the net to obtain infromation. Such the ever so popular desktop gadgets.

With the exception that you can use a simple XML parser to traverse the document. Good for when you have small lightweight applications that access the net to obtain infromation. Such the ever so popular desktop gadgets.

 

Yes, definitely - but for the average web developer and the majority of websites, this wouldn't be needed/useful.

Hi,

 

Divs are for layout, Tables are for tabular data means some times you have to display tabular data from database .that time you use tables . divs always use for design layout.

 

 

 

Regards,

www.cssdog.com

Haha - hey Rachael! You're damn right about HTML; roll on HTML 5, ey! :D

Exactly. HTML is and still is, good for structuring your webpages. :)

Too me, it'll take something amazing to make me switch to something else (but shhhhhh, don't tell anyone that! ;))

Eh, I tend to use XHTML. I like the rules of it. Every tag has to be closed. I like my extra forward slashes! ;)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.