Solved

Why do multiple tables alilgn horizontally and not vertically?

Posted on 2008-10-03
4
538 Views
Last Modified: 2010-04-21


I'm trying to be a better steward  on using CSS & HTML more effectively. On my html page, I have several tables that are supposed to align vertically along the left size.  But, they all "kick-out" to the right.  How do I make the tables align vertically?

Thanks
&
"red faced"
0
Comment
Question by:IT79637
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
rbudj earned 100 total points
ID: 22638052
the only way to get multiple tables to line up horizontally is to place them into their own <td>'s within a main table.  Tables cannot naturally line up horizontally so if you simply place multiple tables one right after another they will line up horizontally.  

Posting your code will allow for better troubleshooting.
0
 
LVL 18

Assisted Solution

by:Hube02
Hube02 earned 100 total points
ID: 22638195
Another reason that they may line up horizontally is if you have them floating on the left (or the right). This can be done in HTML with:

<table align="left">

or in CSS with:

table {
  float: left;
}

Again, if you post your code someone will be able to diagnose your specific issue.
0
 
LVL 44

Assisted Solution

by:scrathcyboy
scrathcyboy earned 100 total points
ID: 22638947
It you are declaring separate tables, as I always do in most of my sites, there are 2 ways to align them --

1.  you can put a master table around everything in the page, and under the one TD, put all your subtables -- this is already mentioned above.  I have found that is not the most flexible way to do things. so I do this --

2.  Just set the parameters the same for each table in sequence --

<TABLE width="780">
<TR>
<TD width= "10">  </TD>
<TD width="550" >  </TD>                           <-- this if for your text
<TD width="200">  </TD>                            <-- this is for an image
<TD width="10">  </TD>
</TR>
</TABLE

 Now just put all tables with the same parameters down the page, and they will all line up, assuming you do not have images that are too big in one table versus the other.

If you are trying to go with a PERCENT size layout for your screen, you will find this will NEVER work.

If you must have everything resize to the browser size, then go with TABLE-LESS layout and use DIVs as they work better for scalable width than do tables/
0
 
LVL 1

Author Closing Comment

by:IT79637
ID: 31502908
All answers had valuable information.  I finally went with defining a table with a "master" table with one row and column and dumped my tables inside the "master" table.  It's ugly, but expedient.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question