...

View Full Version : CSS opacity tags - won't validate



CaptainB
08-09-2007, 06:18 PM
Hi guys!

When I try to validate my CSS ( http://www.xflightx.port10.com/style.css )
I get following errors in the W3C validator: ( LINK (http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.xflightx.port10.com%2Fstyle.css&warning=1&profile=css21&usermedium=all))

95 #dropmenudiv Parse Error - opacity=70)
96 #dropmenudiv Property -moz-opacity doesn't exist : 0.7
97 #dropmenudiv Property opacity doesn't exist : 0.7

How would I correct it?

VIPStephan
08-09-2007, 06:57 PM
You canít correct code that isnít part of any standards in the first place. And the filter property is an invention of Micorsoft while -moz-opacity obviously is a Mozilla-only code. You will never get them to validate according to W3C standards, you can only get rid of them at all.

The opacity property, however, will be valid when the CSS 3 specifications are official. Until then the validator of course will say itís not valid because it isní yet part of any official standards.

CaptainB
08-09-2007, 07:15 PM
Okay, thanks! Also, do you have any clue about when the new standards are official?

Bill Posters
08-09-2007, 08:17 PM
The opacity property, however, will be valid when the CSS 3 specifications are official. Until then the validator of course will say itís not valid because it isní yet part of any official standards.

Fwiw, the W3C CSS validator (http://jigsaw.w3.org/css-validator/) offers the facility to validate according to the CSS3 spec, at least tentatively.

Click on 'More Options' and select CSS3 from the profiles menu.

CaptainB
08-09-2007, 09:02 PM
Thanks for that, Bill. But it still won't validate fully..heck, I can live with it..

Bill Posters
08-10-2007, 08:45 AM
So long as you're using proprietary CSS, you're unlikely to get it 100% valid.

Line #95: filter:alpha(opacity=70);
As far as the IE filter opacity property goes, you could implement an additional IE-specific stylesheet after the main stylesheet via conditional comments (http://www.google.com/search?q=conditional+comments).

Line #96: -moz-opacity:0.7;
The moz-specific one can almost certainly be ditched. Recent versions of Gecko-based UAs should support the CSS3 opacity property natively. (Users with Gecko-based UAs typically update more regularly than those who use the default browsers which come with their OS.)


By removing the moz property and shifting the IE property to its own stylesheet, you should be left with a 100% valid main stylesheet.

CaptainB
08-10-2007, 06:34 PM
Bill, thanks! I'll try it out!

felgall
08-10-2007, 10:44 PM
CSS codes starting with - are supposed to indicate that they are proprietary to a particular browser although for some reason the validator doesn't recognise this.

-moz-something for Mozilla based browsers
-khtml-something for KHTML based browsers
-op-something for Presto based browsers
-ie-something for Trident based browsers

although Microsoft would never consider implementing their proprietary CSS using the standard notation intended for the that purpose and so the last one doesn't actually exist.

gsnedders
08-10-2007, 11:21 PM
although Microsoft would never consider implementing their proprietary CSS using the standard notation intended for the that purpose and so the last one doesn't actually exist.

That's just trying to make MS look bad. All of the proprietary IE extensions which don't use the hyphen or underscore option predate CSS2.1 (which is where the option of using a hyphen or underscore for vendor specific extensions comes from). -ms- is used for proprietary extensions added after it was added to the CSS2.1 WD. And they can't change those that don't use a hyphen or underscore without breaking backwards compatibility.

In this case, filter was introduced with IE4/Win, released when CSS1 was the current standard. I challenge you to find anything in the CSS1 spec saying they should use the above notation.

felgall
08-11-2007, 04:26 AM
Microsoft don't need help to look bad. They had a perfect opportunity to introduce support for CSS2.1 into IE7 and they didn't. They could also introduce the hyphenated proprietary styles as alternatives to their invalid versions too for those people who want to use valid CSS but they haven't done that either. IE7 is so far out of date that all the other browser writers have produced at least two new versions since they had one that was that far behind the current standards. The sooner IE10 is release the better as judging by past performance that will be the version that supports the 2007 standards but it probably wont be released until 2017 if ever. Still with the rapid fall in people using IE instead of a standards compliant browser we probably wont have to worry about IE at all in a few years time.

gsnedders
08-11-2007, 02:14 PM
Microsoft don't need help to look bad. They had a perfect opportunity to introduce support for CSS2.1 into IE7 and they didn't.
Yet they made more progress towards CSS2.1 support than any other browser did during the time IE7 was under development.


They could also introduce the hyphenated proprietary styles as alternatives to their invalid versions too for those people who want to use valid CSS but they haven't done that either.
What makes you think that they are valid? The spec says you're only allowed to use properties defined within the spec. The fact it documents an option (which, under RFC 2119 language, is all it is) for keywords for vendor specific extensions is irrelevant.

I wouldn't be surprised if IE.next had CSS 2.1 support equal to other browsers. Other issues like DOM are far more volatile, as far more pages would break if the behaviour there is changed. I'm not really sure how you expect a browser that wasn't even developed for several years (from 2001 to 2005) to be equal on standards to those that have been under development continuously.

felgall
08-11-2007, 10:36 PM
I don't expect a browser that was abandoned for several years to be equivalent to ones under constant development. The point is that Microsoft abandoned their browser and even the latest version is so far behind the standards that it requires special coding to get it to display pages the same as modern standard compliant browsers do. By the time that there is an IE version that supports CSS2.1 the other browsers will probably support CSS3.

It would also be extremely useful if Microsoft would add support for JavaScript into IE as it is currently the only major browser that doesn't support it. That would then avoid the need to write code to test if the browser is running JavaScript or JScript in order to use the appropriate DOM calls that the two different languages use.

Fortunately the percentage of people using IE instead of modern browsers is rapidly falling and it will soon be a minority browser as well as a non-standard one.

Jutlander
08-12-2007, 12:53 AM
Eh, IE does support Javascript.

MHaris
08-12-2007, 01:57 AM
Why bother validating if something works as you want it? If it works perfectly, no need to take the piss of validating the code.

VIPStephan
08-12-2007, 03:00 AM
Why bother validating if something works as you want it? If it works perfectly, no need to take the piss of validating the code.

Yeah, of courseÖ why bother using semantic HTML and CSS to create websites when tables worked as well? Why bother making progress in something when old ways were working, too? Why bother learning new things when you had an easy living being stupid before?

Any more stupid and useless advice? :rolleyes:

Bill Posters
08-12-2007, 07:03 AM
It would also be extremely useful if Microsoft would add support for JavaScript into IE as it is currently the only major browser that doesn't support it.
Gross exaggerations like that really don't help the community become smarter. Members reading that who might be new to the game, might take it at face value and believe that IE doesn't support js at all.

Try not to create the wrong impression and steer clear of hyperbole.
If js support in the world's most popular browser were anywhere near as bad as you're trying to impress, then js would be little more than an esoteric, marginal technology, rather than one of the three most talked about technologies on the web.

Yes, MS being what they are, there are some frustrations. But making statements such as "IE as it is currently the only major browser that doesn't support it" is far more wrong than right.

MHaris
08-12-2007, 12:12 PM
Yeah, of courseÖ why bother using semantic HTML and CSS to create websites when tables worked as well? Why bother making progress in something when old ways were working, too? Why bother learning new things when you had an easy living being stupid before?

Any more stupid and useless advice? :rolleyes:

Where did I say that use tables or use the old working ways? I am not against validation but I'm just saying that if something is working but is not validating even though it's the right way of doing, ignore it and carry on?

Bill Posters
08-12-2007, 12:27 PM
valid + working is preferable to invalid + working for the same reasons that valid is preferable to invalid.

working is preferable to valid, but valid code improves its chances of working.



I'm just saying that if something is working but is not validating even though it's the right way of doing
Some would say that it can't be invalid and 'the right way' of doing it, because 'the right way' necessarily involves using valid code.
I'd be inclined to agree.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum