Solved

Why do multiple tables alilgn horizontally and not vertically?

Posted on 2008-10-03
4
493 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
4 Comments
 
LVL 16

Accepted Solution

by:
rbudj earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now