Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > opacity

Reply
Thread Tools

opacity

 
 
windandwaves
Guest
Posts: n/a
 
      02-18-2006
Hi Gurus

What is the right way to set opacity in css. I use the one below, but it
gives errors in Firefox:

opacity:.50; filter: alpha(opacity=50); -moz-opacity: 0.50; margin: 0px;

TIA

Nicolaas
PS I also posted this message to the stylesheet newsgroup


 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      02-18-2006
windandwaves wrote:

> opacity:.50; filter: alpha(opacity=50); -moz-opacity: 0.50; margin: 0px;


I'm not entirely sure how the margin effects opacity, but this should do
the trick:

..translucent50
{
opacity: 0.5; /* CSS 3, Moz, Safari, Konq, Opera 9 */
filter: alpha(opacity=50); /* Internet Explorer 5.5+ */
-moz-opacity: 0.5; /* Older Moz */
-khtml-opacity: 0.5; /* Older Safari, Older Konqueror */
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
 
 
 
Julien CROUZET
Guest
Posts: n/a
 
      02-18-2006
windandwaves a écrit :
> Hi Gurus
>
> What is the right way to set opacity in css. I use the one below, but it
> gives errors in Firefox:
>
> opacity:.50; filter: alpha(opacity=50); -moz-opacity: 0.50; margin: 0px;
>


From the CSS validator FAQ :


Why don't my scrollbar properties, filters, etc. validate?

The CSS Validator validates your style sheet against some profile, e.g.
CSS Level 1 or CSS Level 2.
Some browser Vendors however extend these profiles by new properties
like Microsoft did with the scrollbar-base-color or filter property or
Mozilla with the -moz-opacity property. The Validator is not aware of
these properties and using them makes your style sheet invalid in terms
of the CSS specifications. _Either get rid of those properties or live
with the fact, that your style sheets don't validate._ _You cannot have
both._


--
Julien CROUZET - DSI Theoconcept
julien.crouzet@/enlever ca\theoconcept.com
http://www.theoconcept.com


 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      02-18-2006
Julien CROUZET wrote:

> _You cannot have both._ [proprietary CSS and valid CSS]


Actually, you probably can.

There are numerous documented bugs in browser CSS parsers. By tripping the
right ones, you should be able to trick the browsers into reading some
proprietary CSS properties which are really within a CSS comment.

e.g. IE 5.x for Mac will apply this:

/* \*/ /* div{property:value;} */

though a standards-compliant browser should treat it as a comment (as
indeed all other CSS rendering engines seem to) and the CSS validator
should pass it OK.

Not that I'd recommend that in most circumstances.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Jim Higson
Guest
Posts: n/a
 
      02-20-2006
Toby Inkster wrote:

> Julien CROUZET wrote:
>
>> _You cannot have both._ [proprietary CSS and valid CSS]

>
> Actually, you probably can.
>
> There are numerous documented bugs in browser CSS parsers. By tripping the
> right ones, you should be able to trick the browsers into reading some
> proprietary CSS properties which are really within a CSS comment.
>
> e.g. IE 5.x for Mac will apply this:
>
> /* \*/ /* div{property:value;} */
>
> though a standards-compliant browser should treat it as a comment (as
> indeed all other CSS rendering engines seem to) and the CSS validator
> should pass it OK.


Since standards compliant browsers ignore rules they doesn't understand
anyway, this seems like validation for it's own sake. And a nightmare to
maintain.

> Not that I'd recommend that in most circumstances.


I agree

 
Reply With Quote
 
Alan J. Flavell
Guest
Posts: n/a
 
      02-20-2006
On Mon, 20 Feb 2006, Jim Higson wrote:

> Since standards compliant browsers ignore rules they doesn't
> understand anyway, this seems like validation for
> it's own sake.

[1]

There's something in what you say. But if your documents are full of
deliberate non-standard items, you practically lose the ability to use
the validators and checkers for finding non-deliberate errors.

I got myself into just that position only yesterday, in putting ruby
annotation into what was otherwise a valid HTML/4.01 Strict document.
And did just what I'm warning about - at first I missed a real mistake
in the markup. (At least in this situation one could validate against
a custom DTD, and if I decided to go seriously into that, it's what I
would do. But for a one-off hack...)

cheers


[1] news:alt.possessive.its.has.no.apostrophe
 
Reply With Quote
 
Julien CROUZET
Guest
Posts: n/a
 
      02-21-2006
Après mûre réflexion, Toby Inkster a écrit :
> Julien CROUZET wrote:
>
>> _You cannot have both._ [proprietary CSS and valid CSS]

>
> Actually, you probably can.
>


Actually, I think it's :

_You cannot have both._ [proprietary CSS and your sheet validates]

CSS validation, like any validation, is strict like we want it to.


--
Julien CROUZET - DSI Theoconcept
julien.crouzet@/enlever ca\theoconcept.com
http://www.theoconcept.com


 
Reply With Quote
 
Jim Higson
Guest
Posts: n/a
 
      02-21-2006
Alan J. Flavell wrote:

> On Mon, 20 Feb 2006, Jim Higson wrote:
>
>> Since standards compliant browsers ignore rules they doesn't
>> understand anyway, this seems like validation for
>> it's own sake.

> [1]
>
> There's something in what you say. But if your documents are full of
> deliberate non-standard items, you practically lose the ability to use
> the validators and checkers for finding non-deliberate errors.


I'd only ever do this for CSS. XHTML validation is still important.

> I got myself into just that position only yesterday, in putting ruby
> annotation into what was otherwise a valid HTML/4.01 Strict document.
> And did just what I'm warning about - at first I missed a real mistake
> in the markup. (At least in this situation one could validate against
> a custom DTD, and if I decided to go seriously into that, it's what I
> would do. But for a one-off hack...)


For CSS, I just run it through a flex/bison parser to test the syntax. Seems
to work ok. Also, my text editor (kate) is very good at showing bad CSS
syntax.

What I like to do, btw is use server-side PHP to generate stylesheets, and
then run a little shell script to grab the output and turn it back into a
static file.

I also have a little Perl script that strips out whitespace and comments, so
I can write loads of explanations without worrying too much about inflating
the filesize.

--
Jim
 
Reply With Quote
 
windandwaves
Guest
Posts: n/a
 
      02-23-2006
Jim Higson wrote:
> Alan J. Flavell wrote:
>
>> On Mon, 20 Feb 2006, Jim Higson wrote:
>>
>>> Since standards compliant browsers ignore rules they doesn't
>>> understand anyway, this seems like validation for
>>> it's own sake.

>> [1]
>>
>> There's something in what you say. But if your documents are full of
>> deliberate non-standard items, you practically lose the ability to
>> use the validators and checkers for finding non-deliberate errors.

>
> I'd only ever do this for CSS. XHTML validation is still important.
>
>> I got myself into just that position only yesterday, in putting ruby
>> annotation into what was otherwise a valid HTML/4.01 Strict document.
>> And did just what I'm warning about - at first I missed a real
>> mistake in the markup. (At least in this situation one could
>> validate against a custom DTD, and if I decided to go seriously into
>> that, it's what I would do. But for a one-off hack...)

>
> For CSS, I just run it through a flex/bison parser to test the
> syntax. Seems to work ok. Also, my text editor (kate) is very good at
> showing bad CSS syntax.
>
> What I like to do, btw is use server-side PHP to generate
> stylesheets, and then run a little shell script to grab the output
> and turn it back into a static file.


what editor do you use for writing the PHP. I like to edit my css in a css
editor, but if I turn it into a PHP file I can not...

> NIcolaas



 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      02-23-2006
windandwaves wrote:

<snip>
> what editor do you use for writing the PHP. I like to edit my css in a css
> editor, but if I turn it into a PHP file I can not...


I like Crimson Editor(Win32 freeware), beaucoup syntax highlighting
files and you can make custom ones as well

http://www.crimsoneditor.com/


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is -khtml-opacity for? Jim Higson HTML 3 03-05-2006 12:39 AM
Opacity Sentient Fluid HTML 0 04-22-2005 07:45 AM
Opacity in Windows XP Arild Computer Support 5 07-24-2004 04:11 PM
JPanel transparency (opacity) Nebojsa Dinic Java 0 04-16-2004 04:04 PM
CSS3 opacity support in Konqueror 3.1+ and Safari 1.1 DU HTML 13 10-31-2003 12:51 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57