CSS3 Tutorial

Learning CSS3 Step by Step

Creating Triangles with CSS

4

What many people don’t know is that when you are drawing borders in CSS you are actually drawing triangles. Four triangles each represent one border of a box. With coloring one border and setting the others to transparent, you can create a singular triangle.
As you can see in the box below, we have four triangles in different colors.

border-color: red green blue yellow;
border-style: solid;
border-width: 20px;
height: 0px;
width: 0px;

When creating the singular triangle we set a color on one border and the rest transparent. It is done easily yet this is a technique that not many know.

border-color: transparent transparent blue transparent;

We set the border style to solid but when you change this style you will get different results, some examples:

border-style: dotted;

border-style: inset;

border-style: outset;

border-style: double;

Posted on in Tutorial

Comments

4

  1. Will says

    Great work–this really helped me out!

  2. ron says

    Thank you for this great website! The first example on this page (http://css3-tutorial.com/creating-triangles-with-css) has typo in the CSS @ [widht: 0px;] which should be “WIDTH”

    thanks again,
    Ron

  3. admin says

    Thanks for pointing out the error and the kind words!

  4. Mansingh Chaudhary says

    thank you for great solution.

Leave a Reply

winrar download free

winrar download free

download winrar free

download winrar free

winzip activation code

winzip activation code

free winrar download

free winrar download

windows 7 ultimate product key

windows 7 ultimate product key

winzip registration code

winzip registration code

windows 7 key generator

windows 7 key generator

winzip free download full version

winzip free download full version

windows 7 product key

windows 7 product key

free winzip

free winzip

windows 7 activation crack

windows7 activation crack

winrar free

winrar free

winrar free download

winrar free download

winzip free download

winzip free download

winzip freeware

winzip freeware

free winrar

free winrar

windows 7 crack

windows 7 crack

windows xp product key

windows xp product key