using tables in a css document

This is a discussion on "using tables in a css document" within the Web Page Design section. This forum, and the thread "using tables in a css document are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 29th, 2005, 02:22
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
using tables in a css document

Good day,

I`ve got two pages on my site (Questions Answered, and the french translation Questions, Réponses- same prob) that don`t validate because I`m not using proper coding for tables. I`m using h4 to keep them inline, but I know that`s not right. Can someone explain the correct way to code the tables so they`ll stay inline, and validate?

http://pyxnet.ath.cx/robin
Reply With Quote

  #2 (permalink)  
Old Dec 29th, 2005, 04:04
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

I don't understand what you mean by "keeping them inline". A heading tag (your h4) is a block level element that, by default, does nothing different than the table element, except for some padding/margins. So, without the <h4></h4>, what is wrong with the layout?
Reply With Quote
  #3 (permalink)  
Old Dec 29th, 2005, 04:57
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Ok, before I added the <h4></h4>, the tables would appear completely out of place, on the right above the sidebar. When I added the h tags, the tables appeared where they were supposed to be- in the main content. I`m sure this is not the way this is supposed to be done.

Also, the pages don`t validate because of something wrong with the tables` coding- I assumed it to be the h tags being used incorrectly. I`ll go try removing the h tags again, just to check...

Thanks herkalees
Reply With Quote
  #4 (permalink)  
Old Dec 29th, 2005, 15:23
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Ok, same result- the tables go completely haywire.

Btw, what is wrong with this? <h4><table width="60%" border="0">

Apparently what does not validate is in that line.(xhtml)
Reply With Quote
  #5 (permalink)  
Old Dec 30th, 2005, 09:46
drd drd is offline
SuperMember

SuperMember
Join Date: Dec 2005
Location: Hampshire, England, UK
Age: 28
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

A table in a heading probably gives the "block element in inline element" error I'd imagine, can you post what the validator says?

Could try something like :

table { float: left }

in your CSS. I'd have to try it to make sure it works.
Reply With Quote
  #6 (permalink)  
Old Dec 30th, 2005, 13:39
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Quote:
Originally Posted by drd
A table in a heading probably gives the "block element in inline element" error I'd imagine, can you post what the validator says?

Could try something like :

table { float: left }

in your CSS. I'd have to try it to make sure it works.
That will take it out of the document flow, becareful, your results might be even more whacky.
Reply With Quote
  #7 (permalink)  
Old Dec 30th, 2005, 16:58
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Thanks herkalees and drd,

Here are the validator`s results:
  1. Error Line 41 column 48: document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. <h4><table width="60%" border="0"> The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

  2. Error Line 89 column 49: document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. <h4><table width="61%" border="0">
I don`t think I forgot to close an element, so does that mean I should put each table (there are two) in a container of sorts, like what is mentioned? Or could I be missing something in my css?
Reply With Quote
  #8 (permalink)  
Old Dec 30th, 2005, 18:12
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Quote:
Originally Posted by ivyholly
Thanks herkalees and drd,

Here are the validator`s results:
  1. Error Line 41 column 48: document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. <h4><table width="60%" border="0"> The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

  2. Error Line 89 column 49: document type does not allow element "table" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. <h4><table width="61%" border="0">
I don`t think I forgot to close an element, so does that mean I should put each table (there are two) in a container of sorts, like what is mentioned? Or could I be missing something in my css?
Has nothing to do with missing closing tags, it is saying that a table element cannot be within a header. It may work, but it's against the W3C rules.
Reply With Quote
  #9 (permalink)  
Old Dec 30th, 2005, 20:15
drd drd is offline
SuperMember

SuperMember
Join Date: Dec 2005
Location: Hampshire, England, UK
Age: 28
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

yeah its bad practice. You need to find another way of positioning your table. Its hard to say from here, but if you set the margins and width in the css the table should reside within your content div without problems.
If you still have trouble then can you show us what happens?
Reply With Quote
  #10 (permalink)  
Old Dec 30th, 2005, 20:36
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

The float left suggestion worked- my pages all validate now, in fact my whole site now validates. Woohoo!

Thanks drd and herkalees

Now I just need to make a decent banner. And then take a looksee at it in ie- I`m frightened!
Reply With Quote
  #11 (permalink)  
Old Dec 31st, 2005, 17:53
drd drd is offline
SuperMember

SuperMember
Join Date: Dec 2005
Location: Hampshire, England, UK
Age: 28
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

glad to hear it worked, and good luck with IE!
Reply With Quote
  #12 (permalink)  
Old Dec 31st, 2005, 18:07
Up'n'Coming Member
Join Date: Jul 2005
Location: montreal canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: using tables in a css document

Thanks drd

I`ll be making a new post shortly- I`ll need help with the IE issues. Argh...
Reply With Quote
Reply

Tags
using, tables, css, document

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help using document.getElementById jonnymorris JavaScript Forum 3 Mar 28th, 2008 22:52
document.getElementById and document.getElementByName is not working in FF dhineraj JavaScript Forum 3 Jul 26th, 2007 20:23
Help with Downloadable document fallregatta Starting Out 2 Jun 11th, 2007 12:46
can i add word document? monstermunch Starting Out 8 Apr 20th, 2007 16:49
Document Information ClaireB Classic ASP 0 Oct 24th, 2006 17:46


All times are GMT. The time now is 10:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43