473,396 Members | 2,099 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,396 software developers and data experts.

Attribute selector and IE6

I have some CSS that goes something like this:

table.TableStyle {font-family: "Helvetica", "Ariel"; background-
color:white; border-collapse:collapse;}
table.TableStyle COLGROUP[id="ColGroup0"] { background-
color:lavender;}

The second line is a style that is applied to a particular named
COLGROUP element in tables assigned the TableStyle class.
Unfortunately, while this works in most modern browsers (including
IE7), it fails in IE6, which I've discovered doesn't support attribute
selectors.

This could be worked around by assigning the COLGROUP a style
(<COLGROUP class="Style0">, for instance). But that would be less
nifty if the table was changed from "TableStyle" to, say,
"AnotherStyle" (perhaps via a Javascript DOM call), since the COLGROUP
would have to be altered as well. I assume that I'm out of luck if I
want to support IE6 with the existing attribute selector method?

Also, it looks like IE6 doesn't even parse attribute selectors
properly, much less apply them? I tried defining an attribute
selector and a regular one together using the CSS grouping syntax, so
at least the style info would only be defined once:

..EvenStyle, table.TableStyle COLGROUP[id="ColGroupEven"] { background-
color: #DCDCDC; }

this works in the other browsers, but fails with IE6 - "EvenStyle"
doesn't get defined, so I'm assuming their parser choked on the
attribute selector and ignored the entire declaration?

May 10 '07 #1
6 7172
_g*********@oberst.ca wrote:
>
table.TableStyle COLGROUP[id="ColGroup0"] { background-
color:lavender;}
Why don't you just use ID selectors instead of attribute selectors?
Also, it looks like IE6 doesn't even parse attribute selectors
properly, much less apply them?
IE6 is quite deficient and broken when it comes to CSS. Not much you can
do about things it doesn't support, so you can either forget about IE6,
or use another method to get the results you want.

--
Berg
May 11 '07 #2
_g*********@oberst.ca wrote:
I have some CSS that goes something like this:

table.TableStyle {font-family: "Helvetica", "Ariel"; ...
....
Also, it looks like IE6 doesn't even parse attribute selectors
properly, much less apply them?
It might if you spelled it correctly.

table.TableStyle {font-family: helvetica, arial, sans-serif; ...

You don't need quotes around single-word fonts.

I didn't pay much attention to the rest of your post, because you have
errors. Put it on the web, validate it, and come back with the URL.

--
-bts
-Motorcycles defy gravity; cars just suck
May 11 '07 #3
_g*********@oberst.ca wrote :
I have some CSS that goes something like this:

table.TableStyle {font-family: "Helvetica", "Ariel"; background-
color:white; border-collapse:collapse;}
Ariel is not a known font name. I guess you were referring to Arial.
You do not need to quote single word font-family names.
table.TableStyle COLGROUP[id="ColGroup0"] { background-
color:lavender;}
lavender is not a CSS 2.1 reserved color name.

Try
#E6E6FA
instead.
The second line is a style that is applied to a particular named
COLGROUP element in tables assigned the TableStyle class.
Unfortunately, while this works in most modern browsers (including
IE7), it fails in IE6,
In 6-12 months or so, a wide majority of IE6 people will have either
switched to Firefox 3, switched to Opera 10 or to IE 7 (IE 8?).

which I've discovered doesn't support attribute
selectors.
Did you try

#ColGroup0 { background-color: lavender;}

Can you create a webpage, validate the markup code and CSS code and then
just post an url?

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
May 11 '07 #4
Gerard - I'm generating the HTML dynamically based on some parameters,
one of which is the name of a style, which I add to the <TABLE
class=""declaration. The reason the attribute selectors seemed
interesting over a plain ID selector like "#ColGroup0..." is that the
stylesheet in question could then have multiple styles (say,
TableStyle and AlternateStyle), each with its attribute selector
styles for "ColGroup0" or the other identified COLGROUPs, and changing
the single class identifier generated in the the TABLE tag from
"TableStyle" to "AlternateStyle" would pick up the appropriate
attribute selector style. With the "#" example, I'd need something
like "#TSColgroup0..." and "#ASColGroup0...", and either the input to
the HTML generation would need to pass extra information about the
style names or some naming convention would be needed.

As for the IE6 parsing, I inherited some of the style info with the
font typo and nonstandard color name, but those issues aren't relevant
to IE6 parsing. Producing a freestanding example outside our firewall
would be a bit of a pain, but the following (which validates) is a
better example:

table.TableStyle {font-family: helvetica, arial, sans-serif;
background-color:white; border-collapse:collapse;}
table.TableStyle COLGROUP[id="ColGroupEven"], .TSWombat { background-
color: #DCDCDC; }
....
<COLGROUP class="TSWombat" SPAN=3>
<COLGROUP id="ColGroupEven" SPAN=2>

doesn't work in IE6 - in IE7/Safari/Firefox both columns defined by
the COLGROUPs have the grey background color specified, but in IE6
neither do, not even the one using theplain class style TSWombat. It
would have been nice if IE6 would have parsed and ignored the
attribute selector and still handled the class selector, but c'est la
vie. I probably can't get away with non-supporting IE6 on this, so
I'll go back and tweak my generator to do something different.

May 11 '07 #5
_g*********@oberst.ca wrote:
>
With the "#" example, I'd need something
like "#TSColgroup0..." and "#ASColGroup0..."
Maybe I'm dense, but I don't follow your reasoning. Your code:
<COLGROUP id="ColGroupEven" SPAN=2>
table.TableStyle COLGROUP[id="ColGroupEven"] { background-color: #DCDCDC; }
Explain again why you can't do instead:

table.TableStyle COLGROUP#ColGroupEven { background-color: #DCDCDC; }

BTW, IIRC col styling is better supported than colgroup.

--
Berg
May 11 '07 #6
On May 11, 1:56 pm, Bergamot <berga...@visi.comwrote:
Maybe I'm dense, but I don't follow your reasoning. Your code:
<COLGROUP id="ColGroupEven" SPAN=2>
table.TableStyle COLGROUP[id="ColGroupEven"] { background-color: #DCDCDC; }

Explain again why you can't do instead:

table.TableStyle COLGROUP#ColGroupEven { background-color: #DCDCDC; }
No, it is me that is dense! Thanks very much for that example - for
some reason I hadn't realized that the ID selector syntax could be
attached to the end of a class/tag string in that fashion. I'm a
programmer, not a web designer, so I'm coming to CSS through the back
door, and none of the references I was looking at had selector
examples at that level of detail. I seem to remember trying something
similar in my testing, but I probably goofed the syntax.

Using this, I can now get the COLGROUP styling to work on IE6. I'd
seen warnings that some browsers had limited CSS support on COLGROUP,
but I think all of my target group support the limited things I'm
doing (background-color, etc).

By the way, the ID attribute is intended to be unique within a markup
document, but I've been using ColGroupEven and ColGroupOdd on
alternating COLGROUPs in a table. Of course it gives validation
warnings, but I can live with that if it lets me doing the alternating
colors on the columns. It doesn't look like this will cause me
problems with any of the major browsers?

Thanks again,
David Oberst, Yellowknife, NWT, Canada

May 11 '07 #7

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

Similar topics

0
by: J E E | last post by:
Hi, Why can't I create a key and keyref with an attribute declared in an attribute group? Code below describes what I'm trying to accomplish. <!-- An attribute group --> <xs:attributeGroup...
5
by: Russell O'Connor | last post by:
The following XML and Schema doesn't validate in Visual Studio .NET 2003. Is there some mistake I'm making, or is VS.NET in error. The error is r:\test2.xml(3): The key sequence 'foo' in Keyref...
8
by: Brian | last post by:
Hello, The thread on a List Apart made me go visit their site. Wow. If there's a contest for the www's smallest font, they're in the running. I thought it would be a good use of user css. And...
2
by: Isz | last post by:
Hi Group: I would like to know if it is possible to change the name of an attribute to something else. My setup is like this: I have serveral SQL tables that I nest and join so that it all...
5
by: tthunder | last post by:
Hi @all, I am trying to set a key constraint in my XML Schema, which concers all elements containing an attribute named "ID" My XML example: <root> <x ID='1'> <y ID='2'>
2
by: smachin1000 | last post by:
Hi All, In the sample schema & document below, I'd like the attribute "name" to be unique for all function elements under function_list. The tools I'm using (XML Spy and xmllint) all validate...
4
by: news.internode.on.net | last post by:
Is there any way that a STYLE attribute can be used to control the color of hyperlinks. We have a tabular output generator written in C#. Each column of the table is defined by a column, and...
2
by: pstachy | last post by:
Hi again! I have another issue. I would like the attribute of the tag <invoice> to be unique. Made the following schema but unfortunately it doesn't validate. Could someone please indicate what is...
2
by: scdowney | last post by:
First and foremost, thank you in advance for any attempts to help me out. I am working on a project with work, and it requires I use CSS selectors to locate elements within a webpage. For the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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.