I’ve found this cool example of border-color‘s transparent property usage to make an arrow.
I understand how borders are drawn and how an empty element with one side set border can help achieve arrow effect, but what makes me wander in this example is usage of transparent.
Take a look at this simple code:
<div id="daniel"></div>
CSS:
#daniel{
border-color: rgba(111,111,111,0.2) transparent transparent;
border-style: solid;
border-width: 15px;
position: absolute;
}
With this code I get an arrow pointing down. (JSFIDDLE)
With only one transparent I get an hourglass effect. (JSFIDDLE):
border-color: rgba(111,111,111,0.2) transparent;
What confuses me is not knowing what border-{side} transparent refers to in this shorthand properties.
Hope that makes sense.
Any help appreciated.
Thanks 😉
there is a simple rule for the order in which the sides appear in such shorthand notations:
if you have less than 4 arguments, the missing ones are filled with the following rules (depending on how many arguments are present or missing):
so in your example
according to the rules, we have
similar in the other example:
we get the following