Log in

View Full Version : Styling My Table Using CSS



tomyknoker
04-03-2007, 02:38 PM
Hi All,

I have 2 questions, 1st one is I have a caption above my table, which sits on the extreme left. I also want to have the word 'Download' in the caption but want this to sit on the extreme right any ideas?

Also I have lots of data to display so have designed up my css so all the table look the same. The only issue is that because some of the headings aren't very long some of the data is moving onto the next line, do I have to manually set a column width in pixels/percent inside every single table? Or can I add something to my css?

This is how my caption looks...

[code]
<table width="700" border="0" cellspacing="0" cellpadding="0">
<caption>MEMBERS - SEARCH Download Details</caption>
<thead>
<tr>
<th scope="col" class="left">NAME</th>
<th scope="col">DOB</th>
<th scope="col">ADDRESS</th>
<th scope="col">PHONE</th>
<th scope="col" class="right">MOBILE</th>
</tr>
</thead>

cbulmer
04-03-2007, 11:56 PM
if you wanted different widths for each column, just set the width in pixels in the top row of the table, the rest of the table will follow.

If you wanted the same width for all columns, add the following to your css:


.tablecolumnwidth{width:200px;} //Where 200 is the width.

Then add the following to your first row of <TD> tags:


class="tablecolumnwidth"

either way will have your column width problem solved.