So I've been just generating opacity for interactive fading.
I think however, that it's not a good idea to use unrounded values for opacity. If the maximum precision is lower than maximum javascript in precision, the browsers seem to round the value, but consider it changed.
So the question is, what is the maximum precision that makes sense for CSS3 opacity
?
alpha-value A number in the range 0.0 to 1.0, inclusive, or a percentage in the range 0% to 100%, inclusive, representing the opacity of the channel (that is, the value of its alpha channel).
Opacity values are always floating values, minimum value is 0, and maximum value is 1.
The opacity property in CSS specifies how transparent an element is. Opacity has a default initial value of 1 (100% opaque).
Opacity allows for basically any number of decimals you'd like, but the issue is that HTML can only ever change its lightness in 256 different ways. So, the most sensitive opacity would be in something black over something white, which would have a visible variety of 256 different hues. This is because the ratio between R, G, and B must always stay the same to maintain the same colour.
So, since the most sensitive colour has 256 different values, the smallest change that would have an effect on the visible output would be 1/256 = 0.00390625
. In theory, that should be the minimum step size for increasing your opacity.
I've tested this, and using a simple colour picker I noticed that in this example fiddle, the bottom div was the only one which had any change of colour. The top 2 divs had the colour #000000
, and the bottom div had the colour #010101
. So, I would say, based on this, that:
It should be noted that this was all tested in Google Chrome, and like BoltClock said, this might vary per implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With