I want to create an upward and downward facing arrow with css like the following: http://apps.eky.hk/css-triangle-generator/
However, instead of a solid color, I want to set it up so the inside is white and there is just a border around the triangle. (So the triangle would be multi-colored, one color on the inside and a different colored border).
Is this possible, and if so, how can it be done?
To create triangles with only CSS we use a zero width/height element with borders:
Since we are using borders to create the arrow, we can’t just give it a border, but we can overlay one arrow on top of a slightly larger arrow to make the appearance of a border:
HTML —
CSS —
Here is a demo: http://jsfiddle.net/jasper/qnmpb/1/
Update
You can then put both of the triangle DIV elements inside a container and move that container however you want:
HTML —
CSS –
Here is a demo: http://jsfiddle.net/jasper/qnmpb/3/
EDIT (2014):
I just came back to this answer and noticed that separate HTML elements are not necessary to create your double-triangle. You can use pseudo-elements,
:beforeand:after. I.e. replace the.topselector with something like.my-element-that-needs-a-triangle:beforeand the.bottomselector with something like.my-element-that-needs-a-triangle:after.