Borders and blank cells

T

tshad

I have set up my display to be with with a border of 2:

<table border="1" bgcolor="#F6F6F6" style="margin-left:5" width="550" >

and find that the border is 3D, which is fine. But the problem is that if
the field is blank, the cell shows as a flat cell, whereas when there is
anything in the cell it shows inside of a depressed (3D affect) box. This
doesn't look very good. I would like to have the blank boxes be
depressed/inset also. Is there a way to do this?

If not, how do I tell it to just use a line for the borders? That would be
fine, also.

Thanks,

Tom.
 
S

Steve Pugh

tshad said:
I have set up my display to be with with a border of 2:

<table border="1" bgcolor="#F6F6F6" style="margin-left:5" width="550" >

You say 2 but your code says 1.

And margin-left: 5; is wrong. All non-zero lengths in CSS must have
units. You wouldn't want the browser to implement it as 5px when you
meant 5cm would you?

The bgcolor, border and width can all be handled by CSS as well.
and find that the border is 3D, which is fine. But the problem is that if
the field is blank, the cell shows as a flat cell, whereas when there is
anything in the cell it shows inside of a depressed (3D affect) box. This
doesn't look very good. I would like to have the blank boxes be
depressed/inset also. Is there a way to do this?

Either put something in them (a non-breaking space usually suffices)
or use the CSS empty-cells: show;
If not, how do I tell it to just use a line for the borders? That would be
fine, also.

table {border: 1px solid black;} will add a border around the table
alone.
td,th {border: 1px solid black;} will add aborder around each cell.
Read http://www.w3.org/TR/CSS21/box.html#border-properties for the
details of borders in general and
http://www.w3.org/TR/CSS21/tables.html#borders for the details of
applying them to tables.

Steve
 
R

Richard

I have set up my display to be with with a border of 2:
<table border="1" bgcolor="#F6F6F6" style="margin-left:5"
width="550" >
and find that the border is 3D, which is fine. But the problem is that
if
the field is blank, the cell shows as a flat cell, whereas when there
is
anything in the cell it shows inside of a depressed (3D affect) box.
This
doesn't look very good. I would like to have the blank boxes be
depressed/inset also. Is there a way to do this?
If not, how do I tell it to just use a line for the borders? That
would be
fine, also.

Tom.


One of the age old tricks is to put in a 1px transparent gif.
Or put in text the same color as the background, a small character will do.
 
H

Henry

Richard said:
One of the age old tricks is to put in a 1px transparent gif.
Or put in text the same color as the background, a small character will do.



You can make borders that way as well.


<table border="0" width="100%" id="table1" cellspacing="1"
cellpadding="0" bgcolor="#FF0000">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table>

That's not the border, but works very well.

:)
 
T

tshad

Henry said:
You can make borders that way as well.


<table border="0" width="100%" id="table1" cellspacing="1" cellpadding="0"
bgcolor="#FF0000">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table>

That's not the border, but works very well.

:)

But that is a lot of hassle to get it just to print a line as a border
instead of a 3D effect.

It's always something :)
 
T

tshad

Steve Pugh said:
You say 2 but your code says 1.


Actually, it was 2, ,but I changed it just before I copied it and didn't see
it.
And margin-left: 5; is wrong. All non-zero lengths in CSS must have
units. You wouldn't want the browser to implement it as 5px when you
meant 5cm would you?

You are probably right here. I was using a book that didn't use the units:

margin:15 0 15 0;

The bgcolor, border and width can all be handled by CSS as well.


Either put something in them (a non-breaking space usually suffices)
or use the CSS empty-cells: show;

"empty-cells: show;" was exactly what I was looking for.
table {border: 1px solid black;} will add a border around the table
alone.
td,th {border: 1px solid black;} will add aborder around each cell.
Read http://www.w3.org/TR/CSS21/box.html#border-properties for the
details of borders in general and
http://www.w3.org/TR/CSS21/tables.html#borders for the details of
applying them to tables.

I'll need to look into the border-collapse property that these articles talk
about also. But I think the empty-cells is going to handle my problem

Thanks,

Tom
 
T

tshad

tshad said:
But that is a lot of hassle to get it just to print a line as a border
instead of a 3D effect.

I found out what was causing the difference in borders. Apparently,
asp.nets DataGrids, in some circumstances, add a "rules=all" to the table
attributes. This turns the 3D lines into just straight lines. Not sure
why, but that is what seems to be happening. I need to look farther and see
what cause it to do this.

Tom
 
M

Mark Parnell

Previously in alt.html said:
Actually, it was 2, ,but I changed it just before I copied it and didn't see
it.

One of the many reasons it is best to supply a URL when asking for help.
You are probably right here. I was using a book that didn't use the units:

margin:15 0 15 0;

Then that book is a lousy reference. Throw it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top