SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: two tables - why side by side?
-
Oct 16, 2006, 16:55 #1
- Join Date
- Oct 2006
- Posts
- 17
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
two tables - why side by side?
Hello all,
I did a search before posting but could not find an answer to my question below.
I have two tables that I wish to have one on top of the other. Simple and should not be hard.
HTML Code:<table> ... </table> <br /> <table> ... </table>
HTML Code:<table align="left"> ... </table> <br /> <table> ... </table>
Cheers
Marc
-
Oct 16, 2006, 18:39 #2
- Join Date
- Dec 2005
- Posts
- 276
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
There's no need to have a break between those tables.
http://www.w3.org/TR/html4/struct/ta...ef-align-TABLE
Using align="left" on a table moves the table is to the left of the document. Sort of like a float I suppose."Never imagine yourself not to be otherwise than what
it might appear to others that what you were or might
have been was not otherwise than what you had been
would have appeared to them to be otherwise."
-
Oct 16, 2006, 18:52 #3
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Eldacar's right. You need to remove the (depreciated) align="" attribute from the table to fix the issue.
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Oct 16, 2006, 19:06 #4
- Join Date
- Oct 2006
- Posts
- 17
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hello,
Thanks for the link to the spec. I suppose I am just wondering why the align attribute within the table tag controls another tables behaviour...
What could I use instead of the align to say center a table within a web page? Div, span??
Cheers
Marc
-
Oct 16, 2006, 19:09 #5
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Add an ID or class to your table, and then in your stylesheet, give that ID or class the following:
Code:margin: 0 auto;
Please note that align="" is valid in TD and TH elements though.Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Oct 16, 2006, 20:06 #6
- Join Date
- Oct 2006
- Posts
- 17
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you for your help Dan and eldacar!
-
Oct 17, 2006, 04:38 #7
- Join Date
- Sep 2006
- Location
- Nottingham, UK
- Posts
- 3,133
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Just to add:
The align isnt exactly controlling another table's behaviour, it is controlling the first table in the context of the whole page. What you are saying by using align=left is that you want the table to go to the left, and the content that follows to flow around it, much you would with an image for example. The 2nd table is the content that follows, so you would probably get the first table, then to the right the 2nd table maybe a bit lower down because of the line break (maybe not).
Was the table not aligned to the left by default? Why did you need to set align="left" on it?
-
Oct 17, 2006, 15:54 #8
- Join Date
- Oct 2006
- Posts
- 17
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Stormrider
It was my lack of HTML knowledge which caused me to add the align="left" attribute in the table tag. I need to read more
I thought that the align="left" would only be in the scope of the top table tag and all child elements underneath but it seems the attribute controls other high level objects as well - including the second table.
Cheers
Marc
Bookmarks