Hiya,
How do I create a 4x4 (Column x Row) table using CSS?
TicTac
| SitePoint Sponsor |


Hiya,
How do I create a 4x4 (Column x Row) table using CSS?
TicTac


HI TicTac,
To make elements align horizontally all you need to do is give the element a width and a float.
So if you wanted a 400px 4x4 'table' layout something like this should work
Code:#tableyGoodness { width: 400px } #tableyGoodness div { float: left; width: 100px; }Consecutive floats stack up against each other.Code:<div id="tableyGoodness"> <div>1 - 1</div> <div>1 - 2</div> <div>1 - 3</div> <div>1 - 4</div> <div>2 - 1</div> <div>2 - 2</div> <div>2 - 3</div> <div>2 - 4</div> <div>3 - 1</div> <div>3 - 2</div> <div>3 - 3</div> <div>3 - 4</div> <div>4 - 1</div> <div>4 - 2</div> <div>4 - 3</div> <div>4 - 4</div> </div>
But of course - If you are marking up tabular data - the table semantics have much more meaning than the neutral div elements.
Hope it helps![]()


Easy. Use a table, then use CSS to style it. As Mark said though, it does depend on what purpose the container holding the information inside is for. Is this going to hold tabular data?
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

Yep! if it is gonna be holding tabular data then you should use
Code HTML4Strict:<table summary="summary of the table content"> <tr> <td>fluff</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>more fluff1</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>more fluff2</td> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>more fluff3</td> <td>1</td> <td>2</td> <td>3</td> </tr> </table> <!--End of your table -->
then style it with CSS! the links I gave you will offer great inspiration![]()
Bookmarks