Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(Hopefully) easy question

Status
Not open for further replies.

dendenners

Programmer
Jul 17, 2001
110
IE
Hey there,
I am working on a jsp page that consists of a table with rows of data. I want each column in a row to be seperated from the next by a thin black line, but I don't want the rows to be seperated by any line. Do you guys know the easiest way to achieve this? Thanks
 
hi dendenners,
it seems that the most simple way to do this is to use CSS:

<html>

<style>
.brd {border-left: 1px solid black}
</style>

and apply it to the table cell:
<td class=brd> . . .</td>

This will create a vertical black line at left side of all table columns that this class was assigned to.
 
Thanks a million, that works fine.
I would be very grateful if someone could help me with another question related to the same table. At the moment, I'm creating spaces between the columns in the table by having extra columns between each data column. These extra columns just contain '&nbsp'. I am sure there are several more elegant ways of padding a cell horizontally, but not vertically. Would you (or indeed anyone else) know how? Thanks again
 
You could add an addition to Starway's class.

<style>
.brd {border-left: 1px solid black; padding-bottom:5px;}
</style>

Cheers,

Tom
 
Thanks for the input. I actually want to pad the left and right, but adapting that code works fine.
 
Me again.
I have yet another html question. Again it's to do with the same table (the application I'm developing consists of jsp pages containing tables with this kind of layout, and I'm trying to slim down the html as much as possible to speed up transfer times). At the end of this table I need to print the sum total of all values in the last column on the last row. I want to print this total in the right-most column (under the totals that are summed over) Do I have to put in <td></td><td></td>...... <td><value></td> in the html, or is there some way of telling the td to align itself with the right-most col? Thanks again
 
If your table had say 10 columns you could do this.
<tr>
<td colspan=&quot;9&quot;>& nbsp;</td>
<td>Value</td>
</tr>

Hope this is what you meant.

Cheers,

Tom
 
you can do this:
<tr>
<td colspan=&quot;N&quot; align=right>sum total</td>
</tr>

N - this is the number of colomns in any &quot;ordinary&quot; row of your table.

It's also useful to create another class for this table cell to be sure that it lies where you want (by using padding property or some other), and stress text by highlighting it:
<style>
.total { padding-right:5px; font-weight: bold}
</style>

good luck
 
Hey there,
Thanks for the input. That will definately help me
 
dedenners,
you have a solution already but anyway, another way to get a thin line between rows or cols in a table, add in another row or column where you want the line. Insert a transparent gif, specify the size for example width 1px height 100% (vertical), width 100% height 1px (horizontal). then add a background color for that row/col to get the colour line you want. You may need to add rowspan or colspan to get the &quot;line&quot; to go where you want.

Did I confuse the issue?


É
enzo@endamcg.com
 
no that works too, that was (sort of) the way i was doing it before. However, I am trying to reduce as much as possible the html that is sent to the client, so the fewer <tr>s the better. Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top