Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 09:31 PM
Stan Brown
Guest
 
Posts: n/a
Default Borders on empty cell


http://www.acad.sunytccc.edu/instruc...at04/qz05_.htm

A table comes near the beginning of the page. I have the <td> of row
1 column 1 styled in line with border-top:none and border-left:none.
Yet the top and left borders are still present.

I've read the Tables section of the CSS2 spec several times, but
obviously there's something I'm not getting. Can someone help?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
  #2  
Old July 20th, 2005, 09:31 PM
The Plankmeister
Guest
 
Posts: n/a
Default Re: Borders on empty cell

[color=blue]
> A table comes near the beginning of the page. I have the <td> of row
> 1 column 1 styled in line with border-top:none and border-left:none.
> Yet the top and left borders are still present.[/color]

I'm shooting completely in the dark here, because I haven't done much with
CSS & Tables, and haven't looked at the source code, but maybe the border
it's showing top and left is the <table> border, not the <td> border? I
could (and probably am) wrong... but...

HTH.

P.


  #3  
Old July 20th, 2005, 09:31 PM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Re: Borders on empty cell

"The Plankmeister" <plankmeister_NOSPAM_@hotmail.com> wrote:
[color=blue][color=green]
>> A table comes near the beginning of the page. I have the <td> of
>> row 1 column 1 styled in line with border-top:none and
>> border-left:none. Yet the top and left borders are still present.[/color]
>
> I'm shooting completely in the dark here, because I haven't done
> much with CSS & Tables, and haven't looked at the source code, but
> maybe the border it's showing top and left is the <table> border,
> not the <td> border?[/color]

Yes. Setting the border attribute in HTML sets a border both for the
table as a whole and for individual cells.

It would be conceptually best to set borders either in HTML only or in
CSS only, but authors may wish to mix them in order to have some
fallback for non-CSS browsing situations, since data tables with no
borders are often awkward.

Suggestion: Use e.g. <table ... border="2"> in HTML and

table { border-collapse: collapse;
border: none; }
th, td { border: grove 2px; }

in CSS.

By the way, I wonder why Stan's style sheet centers the data cells.
Wouldn't right alignment be more suitable for numeric data?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
  #4  
Old July 20th, 2005, 09:32 PM
Stan Brown
Guest
 
Posts: n/a
Default Re: Borders on empty cell

In article <Xns940EEFDF02BA9jkorpelacstutfi@193.229.0.31> in
comp.infosystems.www.authoring.stylesheets, Jukka K. Korpela
<jkorpela@cs.tut.fi> wrote:[color=blue]
>"The Plankmeister" <plankmeister_NOSPAM_@hotmail.com> wrote:[color=green]
>> I'm shooting completely in the dark here, because I haven't done
>> much with CSS & Tables, and haven't looked at the source code, but
>> maybe the border it's showing top and left is the <table> border,
>> not the <td> border?[/color]
>
>Yes. Setting the border attribute in HTML sets a border both for the
>table as a whole and for individual cells.[/color]

D'oh! That makes complete sense, as soon as it's explained. Now of
course I can't imagine why I didn't see that myself.
[color=blue]
>Suggestion: Use e.g. <table ... border="2"> in HTML and
> table { border-collapse: collapse;
> border: none; }
> th, td { border: grove 2px; }
>in CSS.[/color]

Thanks.
[color=blue]
>By the way, I wonder why Stan's style sheet centers the data cells.
>Wouldn't right alignment be more suitable for numeric data?[/color]

<silly>
I didn't ask that question!!! How dare you make a suggestion that I
didn't specifically ask for? Some people are really arrogant!!! I
come here for help and you just pick holes in what I'm doing!!! I
had good reasons for centering those numbers, but you are too stupid
to understand them!!!
</silly>

Unlike some on this newsgroup, I am grateful for all suggestions. I
agree that right justification would make more sense. Thanks!

How good is browser support for text-align:"." ? That might be even
more appropriate than text-align:right. (These particular figures
are all whole numbers, but some other tables have mixed whole
numbers and decimals.)

By the way, the centering is done by this bit of styling:
table.internallycentered td { text-align:center }
I couldn't think of a good functional (as opposed to presentational)
name for the class when I created it. But I think in fact all or
nearly all uses of "internallycentered" are for tables of numbers.

The good news is that I can change _one_ place and that will fix
most or all of them. The bad news is that I would then have
table.internallycentered td { text-align:right }
So I guess I'd better use a better class name, like "mostlynumbers".
:-)

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
  #5  
Old July 20th, 2005, 09:32 PM
Jukka K. Korpela
Guest
 
Posts: n/a
Default Support to text-align: ".", and workarounds

Under Subject: Re: Borders on empty cell
Stan Brown <the_stan_brown@fastmail.fm> wrote:
[color=blue]
> How good is browser support for text-align:"." ?[/color]

Nonexistent, as far as I know. And this feature has been removed from
the CSS 2.1 draft, which is primarily an attempt to describe CSS
as currently implemented in modern browsers (and should therefore have
been named CSS 1.5 or something like that, but numbering of WWW related
specification and draft versions is traditionally illogical).
( http://www.w3.org/TR/CSS21/text.html#propdef-text-align )
[color=blue]
> That might be even
> more appropriate than text-align:right. (These particular figures
> are all whole numbers, but some other tables have mixed whole
> numbers and decimals.)[/color]

Yes, text-align with a character or string value was basically meant
for such usage. But it was not implemented.

There's no good workaround I'm afraid. You could right pad all your
numbers so that all numbers in a column with decimal numbers have the
same amount of characters to the right of the decimal point, and right
align those cells. But there is no guarantee that this will align the
decimal points, since the characters to the right of it do not need to
have the same width. And all approaches to this have problems:
- using zeros works in practice (since fonts used by Web browsers
tend to have equal-width glyphs for digits) presentationally but
often gives a wrong impression of precision
- using no-break spaces generally does not work (its width is different
from the width of numbers), and
- if you try to fix this by setting the font to monospace, the
appearance becomes rather ugly (even the decimal point will be of
the same width, unless you add extra markup to exclude it)
- using the U+2007 FIGURE SPACE character (defined, in Unicode, as
having the same width as "the digit width of fonts with fixed-width
digits") would fail badly in browsing situations where the browser
lacks Unicode support or the font lacks the character.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
  #6  
Old July 20th, 2005, 09:34 PM
Stan Brown
Guest
 
Posts: n/a
Default Re: Borders on empty cell

In article <MPG.19ee34fc9e711c2298b51a@news.odyssey.net> in
comp.infosystems.www.authoring.stylesheets, Stan Brown
<the_stan_brown@fastmail.fm> wrote:[color=blue]
>
>http://www.acad.sunytccc.edu/instruc...at04/qz05_.htm
>
>A table comes near the beginning of the page.[/color]

And following Jukka's suggestions I now have CSSized the borders --
and spacing, while I was about it.

Can I verify my (now slightly increased) understanding of
<http://www.w3.org/TR/REC-CSS2/tables.html>, to wit: in the
collapsing border model, there is no way to suppress borders of
empty cells automatically, nothing to correspond to empty-cells?

What I've done is to create a class "tlnotch" with border-left and
border-top set to none, and assigned that class to the upper-left
cell of that table. Is there a better way, or is that about it?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
  #7  
Old July 20th, 2005, 09:34 PM
Lauri Raittila
Guest
 
Posts: n/a
Default Re: Borders on empty cell

In article <MPG.19f5008138d8170b98b55d@news.odyssey.net>, Stan Brown
wrote:[color=blue]
> In article <MPG.19ee34fc9e711c2298b51a@news.odyssey.net> in
> comp.infosystems.www.authoring.stylesheets, Stan Brown
> <the_stan_brown@fastmail.fm> wrote:[color=green]
> >
> >http://www.acad.sunytccc.edu/instruc...at04/qz05_.htm
> >
> >A table comes near the beginning of the page.[/color][/color]
[color=blue]
> Can I verify my (now slightly increased) understanding of
> <http://www.w3.org/TR/REC-CSS2/tables.html>, to wit: in the
> collapsing border model, there is no way to suppress borders of
> empty cells automatically, nothing to correspond to empty-cells?[/color]

IIANM you are right. But you could emulate collapsing model using
separate modell ;-)
[color=blue]
> What I've done is to create a class "tlnotch" with border-left and
> border-top set to none, and assigned that class to the upper-left
> cell of that table. Is there a better way, or is that about it?[/color]

Other ways, at least:

tr:firstchild > td:firstchild {border:none} ?

To get it work on winIE whitout class I would try to add thead and then
use
thead td {border:none}

It would be inconvient to try selecting empty cells from other places
without classes, but upper left corner of table-row-group element.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

  #8  
Old July 20th, 2005, 09:35 PM
Stan Brown
Guest
 
Posts: n/a
Default Re: Borders on empty cell

In article <MPG.19f6075b3bcc0cb2989cb7@news.cis.dfn.de> in
comp.infosystems.www.authoring.stylesheets, Lauri Raittila
<lauri@raittila.cjb.net> wrote:[color=blue]
>In article <MPG.19f5008138d8170b98b55d@news.odyssey.net>, Stan Brown
>wrote:[color=green]
>> What I've done is to create a class "tlnotch" with border-left and
>> border-top set to none, and assigned that class to the upper-left
>> cell of that table. Is there a better way, or is that about it?[/color]
>
>Other ways, at least:[/color]
[snip suggestion with 'firstchild'][color=blue]
>To get it work on winIE whitout class I would try to add thead and then
>use
>thead td {border:none}
>
>It would be inconvient to try selecting empty cells from other places
>without classes, but upper left corner of table-row-group element.[/color]

I rather like this approach. I ought to be using <thead> anyway, and
I think this form is more widely supported than firstchild.
Kiitos!(*)


(*) Did I get that right? If so, it's the only word of Finnish I
know.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles