473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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/
Jul 20 '05 #1
7 5080
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'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.
Jul 20 '05 #2
"The Plankmeister" <pl******************@hotmail.com> wrote:
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'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?


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/
Jul 20 '05 #3
In article <Xn*****************************@193.229.0.31> in
comp.infosystems.www.authoring.stylesheets, Jukka K. Korpela
<jk******@cs.tut.fi> wrote:
"The Plankmeister" <pl******************@hotmail.com> wrote:
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?
Yes. Setting the border attribute in HTML sets a border both for the
table as a whole and for individual cells.


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.
Suggestion: Use e.g. <table ... border="2"> in HTML and
table { border-collapse: collapse;
border: none; }
th, td { border: grove 2px; }
in CSS.
Thanks.
By the way, I wonder why Stan's style sheet centers the data cells.
Wouldn't right alignment be more suitable for numeric data?


<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/
Jul 20 '05 #4
Under Subject: Re: Borders on empty cell
Stan Brown <th************@fastmail.fm> wrote:
How good is browser support for text-align:"." ?
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 )
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.)


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/
Jul 20 '05 #5
In article <MP************************@news.odyssey.net> in
comp.infosystems.www.authoring.stylesheets, Stan Brown
<th************@fastmail.fm> wrote:

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

A table comes near the beginning of the page.


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/
Jul 20 '05 #6
In article <MP************************@news.odyssey.net>, Stan Brown
wrote:
In article <MP************************@news.odyssey.net> in
comp.infosystems.www.authoring.stylesheets, Stan Brown
<th************@fastmail.fm> wrote:

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

A table comes near the beginning of the page.
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?
IIANM you are right. But you could emulate collapsing model using
separate modell ;-)
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?


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.

Jul 20 '05 #7
In article <MP************************@news.cis.dfn.de> in
comp.infosystems.www.authoring.stylesheets, Lauri Raittila
<la***@raittila.cjb.net> wrote:
In article <MP************************@news.odyssey.net>, Stan Brown
wrote:
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?
Other ways, at least:

[snip suggestion with 'firstchild']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.


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/
Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hostile17 | last post by:
I've been trying to figure out a good way to make a CSS layout with nice-looking 1-pixel borders around the table cells. The only broadly compatible way to do this I know of is to have * the...
5
by: Analysis&Solutions | last post by:
Hi Folks: I've got a weird phenomenon going on with Internet Explorer on the Macintosh... The vertical cell borders are missing between the cells but appear above and below the cells! Here's...
5
by: Jeff North | last post by:
I'm trying to print a tables' cell/row but when a cell/row is split across 2 pages the cell bottom/top border doesn't print on either page. Like this: +--------+-----------------------------+ | ...
4
by: Konrad Viltersten | last post by:
As it isnow i have to use a syntax for my tables as: <table class = "some" border> and/or <table class = "some" noborder> Now, what i'd like to do is to make that border-thingy...
1
by: Glen Vermeylen | last post by:
Hi, For a project at school we have to automate the assignment of seats in classrooms to students during the exams. The lady who previously did everything manually kept the layouts of the...
0
by: landon.chelf | last post by:
I'm working with a RichTextBox control and am loading the following rtf into it. {\rtf1\ansi\deff0 {\fonttbl {\f0\fswiss Arial;} } \deflang1033\plain\fs20 {\pard...
10
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting...
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
17
by: Grant Kelly | last post by:
I'm wondering if it's possible within HTML markup (or possibly CSS) to specify that an HTML table's headers should be placed 'over' the cell borders rather than 'within' the cells. For example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.