473,666 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using attributes on a <col>

I have a table listing various translations of the titles of a set of
books. Each row represents a book, each column represents a language.
It looks like this:

+-------------------+------------------+-------------------+
| Français | English | Deutsch |
+-------------------+------------------+-------------------+
| Le tour du monde | Around the world | Die Reise um die |
| en 80 jours | in 80 days | Erde in 80 Tagen |
+-------------------+------------------+-------------------+
| Autour de la Lune | Around the Moon | Reise um den Mond |
+-------------------+------------------+-------------------+

I would very much like to indicate the language for these titles with a
lang=".." attribute. Not that I expect any screenreader to be able to
handle all the 78 languages I have in my table so far, but I'd like to
indicate the languages anyway.

The most obvious thing to do would be using <col> elements, and giving
them the appropriate lang attributes:

<table>
<col lang="fr"></col><col lang="en"></col><col lang="de"></col>
....
</table>

That should mark all cells in the first column as French, all cells in
the second column as English, and all cells in the third column as
German, right?

Except that it doesn't seem to work as expected. At least, if I include
a CSS declaration like *[lang=fr]{color:green;}, just to see if it
works, it doesn't do anything. Perhaps I'm misinterpreting the
semantics of <col> or the [attr=value] selector.

Does anyone have experience with the use of <col> in this kind of
situation? Is it worth bothering about?

If <col> doesn't work, I'd have to set the lang attribute on each
individual <td>, which seems a bit of an overkill...

Aug 14 '05 #1
5 1799
"Garmt de Vries" <gd*****@hotmai l.com> wrote:
I have a table listing various translations of the titles of a set of
books. Each row represents a book, each column represents a language. - - I would very much like to indicate the language for these titles with a
lang=".." attribute. - - The most obvious thing to do would be using <col> elements, and giving
them the appropriate lang attributes:
Right.
<col lang="fr"></col><col lang="en"></col><col lang="de"></col>
Well, that's invalid in HTML 4.01 and not recommended in XHTML either.
Don't use end tags </col>. If you must play the XHTML game, use
<col lang="fr" /><col lang="en" /><col lang="de" />
That should mark all cells in the first column as French, all cells in
the second column as English, and all cells in the third column as
German, right?
Indeed, except those cells that have their language set in the cells
themselves or in the <tr> elements.
Except that it doesn't seem to work as expected.
Language markup generally doesn't work as expected; the W3C material is far
too optimistic and promises too much in this issue. Stay tuned to having
any lang attribute settings ignored most of the time. Support to them in
speech browsers is getting better, though, as far as I know.
At least, if I include
a CSS declaration like *[lang=fr]{color:green;}, just to see if it
works, it doesn't do anything.
On which browser(s)? For example, IE knows nothing about such selectors.
Opera has some support.
Perhaps I'm misinterpreting the
semantics of <col> or the [attr=value] selector.


I don't think so. Rather, browser support is poor, and there are some
pitfalls in inheritance (in the CSS sense) and in inheritance (in the
obscurely defined HTML sense) for tables.

First, note that *[lang=fr] (which means the same as [lang=fr]) refers to
those elements that have the lang attribute set to value "fr" and this is
probably to be interpreted so that the elements have that attribute in the
markup, not "inherited" . Thus, you manage to set (on the few supporting
browsers) the color property for col elements, but this has no effect,
since that property is not inherited (in the CSS sense) into cells. The
language information is "inherited" into cells, but it's still the <col>
element that carries the lang attribute, not <td> elements.

In principle, you could use
:lang(fr) {color:green;}
and this should affect the color of the cells, unless I've missed
something. The selector should match all elements that have their language
set to "fr" either directly in the element's lang attribute or indirectly
by an enclosing element's language setting. This doesn't seem to work even
on Opera, though.

If you try setting the background color, things are different, since the
background behaves differently in CSS. You can set background for a column
and it shines through for all cells that have their own background set to
transparent, which is the default.

I would just set the lang attribute for <col> elements. That's the right
thing to do, and it doesn't take much time. But don't expect to be able to
base styling on it.

To style a column of a table, the really safe way (to the extent that
styling can be safe) is to set a class attribute for each cell in the
column, and use a class selector. This is tedious and makes the source
ugly, but hopefully you can find some automated tool for it.

It's sad that such a basic styling task is so difficult, but the HTML and
CSS table models are really something rather weird. If you wish to get mad
in trying to understand the mess, you might as well start at
http://archivist.incutio.com/viewlist/css-discuss/34844
which probably hits on the nail by discussing how the rendering of tables
is supposed to work in CSS (for some value of "work").

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Aug 14 '05 #2
Garmt de Vries wrote:

I have a table listing various translations of the titles of a set of
books. Each row represents a book, each column represents a language.
It looks like this:

+-------------------+------------------+-------------------+
| Français | English | Deutsch |
+-------------------+------------------+-------------------+
| Le tour du monde | Around the world | Die Reise um die |
| en 80 jours | in 80 days | Erde in 80 Tagen |
+-------------------+------------------+-------------------+
| Autour de la Lune | Around the Moon | Reise um den Mond |
+-------------------+------------------+-------------------+

I would very much like to indicate the language for these titles with a
lang=".." attribute. Not that I expect any screenreader to be able to
handle all the 78 languages I have in my table so far, but I'd like to
indicate the languages anyway.

The most obvious thing to do would be using <col> elements, and giving
them the appropriate lang attributes:

<table>
<col lang="fr"></col><col lang="en"></col><col lang="de"></col>
...
</table>

That should mark all cells in the first column as French, all cells in
the second column as English, and all cells in the third column as
German, right?

Except that it doesn't seem to work as expected. At least, if I include
a CSS declaration like *[lang=fr]{color:green;}, just to see if it
works, it doesn't do anything. Perhaps I'm misinterpreting the
semantics of <col> or the [attr=value] selector.

Does anyone have experience with the use of <col> in this kind of
situation? Is it worth bothering about?

If <col> doesn't work, I'd have to set the lang attribute on each
individual <td>, which seems a bit of an overkill...


The basic problem is that the implementation of characteristics for
both the column (tag <col>) and column-group (tag <colgroup>)
elements is buggy for many browsers. This is true for both HTML
attributes and CSS styles.

For Mozilla and Firefox, see the long-running bug #915. First
written 26 September 1998, it has accumulated 246 comments on
whether to fix it and, if so, how. Many of those comments argue
about how to interpret the HTML 4.01 and CSS specifications. The
assignment for fixing this has been changed six times in seven
years. It's still not fixed.

One symptom of this bug is that attributes or styles for horizontal
or vertical alignment are ignored. On the other hand attributes
and styles for column widths work.

See <URL:https://bugzilla.mozill a.org/show_bug.cgi?id =915>.

I understand that IE is also buggy in this area.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Aug 15 '05 #3
Jukka K. Korpela wrote:
<col lang="fr"></col><col lang="en"></col><col lang="de"></col>
Well, that's invalid in HTML 4.01 and not recommended in XHTML either.
Don't use end tags </col>. If you must play the XHTML game, use
<col lang="fr" /><col lang="en" /><col lang="de" />


OK, thanks for pointing that out.
That should mark all cells in the first column as French, all cells in
the second column as English, and all cells in the third column as
German, right?


Indeed, except those cells that have their language set in the cells
themselves or in the <tr> elements.


Obviously. But no <tr> or <td> is going to carry a lang attribute
anyway.
At least, if I include
a CSS declaration like *[lang=fr]{color:green;}, just to see if it
works, it doesn't do anything.


On which browser(s)? For example, IE knows nothing about such selectors.
Opera has some support.


I always test this kind of stuff on Opera and Firefox. If it works for
IE, that's a bonus, but a priori I don't expect that.
First, note that *[lang=fr] (which means the same as [lang=fr]) refers to
those elements that have the lang attribute set to value "fr" and this is
probably to be interpreted so that the elements have that attribute in the
markup, not "inherited" . Thus, you manage to set (on the few supporting
browsers) the color property for col elements, but this has no effect,
since that property is not inherited (in the CSS sense) into cells. The
language information is "inherited" into cells, but it's still the <col>
element that carries the lang attribute, not <td> elements.
Well, it's primarily the language information that I want to propagate
to the cells. I just used some CSS styling to test if this worked,
because I don't have a speech browser or other tool that looks at
language information. But you're right, the *[lang=fr] approach won't
work because the <td>s don't CSS-inherit from the <col>s.
In principle, you could use
:lang(fr) {color:green;}
and this should affect the color of the cells, unless I've missed
something. The selector should match all elements that have their language
set to "fr" either directly in the element's lang attribute or indirectly
by an enclosing element's language setting. This doesn't seem to work even
on Opera, though.
Indeed, I get the same results as with *[lang=fr].
I would just set the lang attribute for <col> elements. That's the right
thing to do, and it doesn't take much time. But don't expect to be able to
base styling on it.
Fortunately, that wasn't my goal. I just want to do the right thing,
and I was wondering if it had any effect...
To style a column of a table, the really safe way (to the extent that
styling can be safe) is to set a class attribute for each cell in the
column, and use a class selector. This is tedious and makes the source
ugly, but hopefully you can find some automated tool for it.


I could do that, indeed, but for the moment I don't need to.
Garmt de Vries.

Aug 16 '05 #4

Garmt de Vries wrote:
Jukka K. Korpela wrote:
Indeed, except those cells that have their language set in the cells
themselves or in the <tr> elements.


Obviously. But no <tr> or <td> is going to carry a lang attribute
anyway.

.... "on this particular page of mine", I should have added.

Aug 16 '05 #5
Garmt de Vries wrote:
<table>
<col lang="fr"></col><col lang="en"></col><col lang="de"></col>
...
</table>

That should mark all cells in the first column as French, all cells in
the second column as English, and all cells in the third column as
German, right?
Apparently so.
if I include a CSS declaration like *[lang=fr]{color:green;}, just to
see if it works, it doesn't do anything.


http://ln.hixie.ch/?start=1070385285&count=1

I'm not sure why a browser can assign some things to cells based on the
<col> element, but not others.

--
Brian

Aug 16 '05 #6

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

Similar topics

1
9520
by: Daniel Haude | last post by:
Me again! This time I'd like to prevent an entire column of a table to have no word-wrapping. So I defined this class in the style sheet: ..nobr { white-space: nowrap; } When I define table cells like this: <td class="nobr"> everything works
7
2318
by: Philip Herlihy | last post by:
If I'm reading my reference books correctly, I should be able to pick out cells in a table by combining a <col> selector with a class selector, like this: col#thisid td.thisclass {color: red; } ... but it doesn't work. I can get the unadorned <col> selector to work in IE6 and Opera (not Dreamweaver 2004): col#thiscol {color: red; } ... but when I add a descendent selector it stops working. I'd be grateful for advice or comments.
6
4646
by: Joe Morrison | last post by:
By my reading of the HTML standard: http://www.w3.org/TR/REC-html40/struct/tables.html the HTML shown below should display the text "Enter password" with the input field immediately adjacent, since the first column uses the "0*" proportional width attribute to request minimum column width. This example works perfectly if viewed with Mozilla/Firefox, but under Internet Explorer, Safari, and Opera it displays with lots of
7
3273
by: François de Dardel | last post by:
It seems these two tags don't work well, except in MSIE for PC. See http://mapage.noos.fr/dardelf4/LaFontaine/Liste_des_fables.html with some other browser. I have tried 4 browsers for the Mac, and none accepts to align the last two columns to the right. Is there a way to achieve that without putting an ALIGN="right" into every cell ? Thanks in advance for any hint.
36
5092
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT do so, since this is not part of the specification. How then to you apply styles to entire columns? Surely you don't have to write <td class="behold"on every row item.
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8363
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8787
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8561
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.