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.

What DOCTYPE to use if using HTML/CSS codes and want to make tables?

Featured Replies

Hi

 

I am making a website with HTML and CSS.

 

I wanted to make tables so I use a code like:

 

<table>
<tr>
<td>
Welcome!
</td>
<td>
This is my website!
</td>
</tr>
</table>

 

I want to validate its HTML but HTML Validator says that it's not allowed to use the <td> tags with the DOCTYPE I am using; the DOCTYPE I'm using is

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">

 

What DOCTYPE should I be using?

As said above, you shouldn't lay a website out in tables.

 

Tables are for tabular data only.

As said above, you shouldn't lay a website out in tables.

 

Tables are for tabular data only.

 

I only use them for my forms ;)

I only use them for my forms ;)

 

Why not <form>, <label> and <fieldset> tags? Surely these are a more appropriate way to represent the content?

 

I kind of hate the whole forms and tables thing, deep down i know forms are probably tabular inputs, i just can't see that as the best approach.

 

Try pretending to be blind, would you much rather ask a user to insert the missing data into a table, or to fill in a form?

 

Another consideration to make is that screen-readers read tables in a linear fashion, they read across each row in turn, this default behaviour needs to be taken into consideration when designing a form within a table.

 

Just my $0.02

  • Author

Wow I just saw all these answers, I thought my problem was fixed after my second message.

 

What do you guys mean with laying out a website in tables? Please explain me.

 

I discovered how to make tables and I thought they look cool on my website.

 

I use them on my first page to write news about my website, for example each "new" has its own table.

 

Is something wrong with that? I didn't understand what you guys mean.

Wow I just saw all these answers, I thought my problem was fixed after my second message.

 

What do you guys mean with laying out a website in tables? Please explain me.

 

I discovered how to make tables and I thought they look cool on my website.

 

I use them on my first page to write news about my website, for example each "new" has its own table.

 

Is something wrong with that? I didn't understand what you guys mean.

 

 

They mean that you shouldn't use tables to position information on your website (unless it is information that is supposed to be in a table) and definitely not for the structure of your website. From your description, I'm guessing your news section doesn't need to be in a table. You can surround the information with <div></div> tags and use CSS to define how it looks on the page. Do you have some CSS knowledge?

  • Author

thanks B2F.

 

I do have some knowledge with CSS but not a lot.

 

I am trying to replicate my table design with CSS now.

 

How can I make an outlining border around the div?

 

Also how could I make there be dividing horizontal line separating a div into two sections?

thanks B2F.

 

I do have some knowledge with CSS but not a lot.

 

I am trying to replicate my table design with CSS now.

 

How can I make an outlining border around the div?

 

Also how could I make there be dividing horizontal line separating a div into two sections?

 

you can use

 

#div { border: 1px solid #000000: } for the border

 

between divs you could use <hr> and then style the hr in the css or use an image (not sure if <hr> is still correct)

@pat24, i still use <hr />, it's also remaining in the new html5 spec, so fairly future proof for now.

 

According to the new html5 spec though, <hr /> defines a change in content (as opposed to being a merely aesthetic line).

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.