?
Solved

Centering rows with HTML..

Posted on 2007-07-24
3
Medium Priority
?
274 Views
Last Modified: 2008-02-20
Hi,

In a HTML table, with differing numbers of cells per row, how can you center the cells within the row, that have less cells per row?

Ie...  

x x x
 x x
x x x

The rows with three cells are just fine of course, but how can I center the cells in the row with two cells only?

Thanks
David
0
Comment
Question by:dwessell
3 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 19558265
You can't using a html table for this type of layouting as far as I am aware.
I'm scratching my head if there is a easy solution using div's instead.

-r-
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 19558414
tables work, but complicated. You can try span's within a div like:
<div style="text-align:center; width:200px;">
<span>x</span>
<span>x</span>
<span>x</span><br />
<span>x</span>
<span>x</span><br />
<span>x</span>
<span>x</span>
<span>x</span>
</div>

Table would go like this:
<table><tr>
<td colspan="2">x</td>
<td colspan="2">x</td>
<td colspan="2">x</td>
</tr><tr>
<td colspan="3">x</td>
<td colspan="3">x</td>
</tr><tr>
<td colspan="2">x</td>
<td colspan="2">x</td>
<td colspan="2">x</td>
</tr></table>
0
 

Author Comment

by:dwessell
ID: 19558508
Setting all rows to 6 cells and the dividing it did the trick.. Good call..

Thanks
David
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 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