I was looking at some stylesheets when I noticed one that I used linear-gradientwith rgba()color stops, in which numbers rgbaused multiple instances of 0 instead of one 0
background-image:linear-gradient(to top left, rgba(000,000,000,0.1),rgba(100,100,100,1));
I have not seen several zeros (instead of one zero) occupying one slot in the rgb / a color space before, but confirmed in CodePen, this is valid. Then I looked at the definition of the W3C number here .
To make a long story short, after some pushing and digging, I did not understand that I could bring an indefinite number of zeros to length and get the same result as without zeros, like this:
/* The two squares generated have equivalent width and height of 100px - for giggles, I also extended the same idea to the transition-duration time */
<style>
div.aaa {
width:00000000100px;
height:100px;
background-image:linear-gradient(to top left,rgba(000,000,000,0.1),rgba(100,100,100,1));
transition:1s cubic-bezier(1,1,1,1)
}
div.bbb {
width:100px;
height:000000000000000000000000000000000100px;
background-color:green;
transition:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001s cubic-bezier(1,1,1,1)
}
div:hover { background-color:red }
</style>
<div class="aaa"></div>
<div class="bbb"></div>
It is difficult to directly verify that these numbers are equivalent representations, since using the scripting language:
$x = 100;
$y = 00000000000100;
echo ($x == $y) ? 'true' : 'false';
var x = 100;
var y = 00000000000100;
var res = (x == y) ? 'true' : 'false';
alert(res);
These examples tell me that CSS does not process, for example. 0000100 as an octal number, but rather as a decimal (or at least not octal numbers), since the value width, heightand transition-durationfor the elements generated above, the html seems to be the same.
CSS , , ,
- CSS, , , - ?