![]() ![]() You can also play with opacity, although this might be a tad too much and have unwanted side effects in your case. There's also the HEXA notation (or RRGGBBAA) now supported on all major browsers, which is pretty much the same as RGBA but using hexadecimal notation instead of decimal: color: #FF000080 /* red at 50% opacity */Īdditionally, if you just want a transparent background, the simplest way to do it is: background: transparent Is your business facing precision motion and automation challenges Our experts can solve them with our custom motion control solutions. All of the following result in "transparent" even though the color part is set to 100% red, green and blue respectively: color: rgba(255, 0, 0, 0) /* transparent */Ĭolor: rgba(0, 255, 0, 0) /* transparent */Ĭolor: rgba(0, 0, 255, 0) /* transparent */ If you want "transparent", just set the last number to 0, regardless of the color. You can't code transparency as pure RGB (which stands for red-green-blue channels), but you can use the RGBA notation, in which you define the color + alpha channel together: color: rgba(255, 0, 0, 0.5) /* red at 50% opacity */ Transparency is a property outside the color itself, and it's also known as alpha component. The next three digits represent the green, blue, and alpha channels, respectively.įor the most part, Chrome and Firefox have started supporting this: The first digit, interpreted as a hexadecimal number, specifies the red channel of the color, where 0 represents the minimum value and f represents the maximum. This is a shorter variant of the 8-digit notation, "expanded" in the same way as the 3-digit notation is. In other words, #0000ffcc represents the same color as rgba(0, 0, 100%, 80%) (a slightly-transparent blue). ![]() The last pair of digits, interpreted as a hexadecimal number, specifies the alpha channel of the color, where 00 represents a fully transparent color and ff represent a fully opaque color. The first 6 digits are interpreted identically to the 6-digit notation. In other words, a hex color is written as a hash character, "#", followed by some number of digits 0-9 or letters a-f (the case of the letters doesn’t matter - #00ff00 is identical to #00FF00). The syntax of a is a token whose value consists of 3, 4, 6, or 8 hexadecimal digits. I am not sure about its browser support for now but, you can check the DRAFT Docs for more information. There's a relatively new way of doing transparency, it's called HEXA (HEX + Alpha). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |