Creating triangles using borders
Posted
by
Interstellar_Coder
on Stack Overflow
See other posts from Stack Overflow
or by Interstellar_Coder
Published on 2012-03-31T23:07:35Z
Indexed on
2012/03/31
23:30 UTC
Read the original article
Hit count: 196
css
I recently needed to create speech bubbles. To create the little tip at the end of the speech bubble, i used a css technique where the element is given a 0
width
and 0
height
and given borders. Making certain borders transparent would create diagonals.
This works great, and i am able to manipulate different borders to create triangles/shapes to my liking. The problem is, i don't fully understand why this works. I understand that it all starts out with a rectangle and as you set one or more of the borders to transparent it creates a diagonal. My question is how does this work ? And why does it create a diagonal in the first place ?
EDIT: To clarify, i would like to know the theory behind why this technique works.
© Stack Overflow or respective owner