Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • CSS Triangle

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4
    • 0
    • 624
    Comment on it

    Hello Readers.

    CSS gives us the freedom to draw many shapes and figures. But a triangle is one, that particularly amazes me. A triangle is made in 5 easy steps.

    1. Imagine a box with borders on all four sides with equal width. Notice how the borders meet at angles (shown by red line).

        2. Remove the border from top.

       3. Give the box 0 height and width.

       4. Make the border transparent.

       5. Finally, make the other two side borders transparent as well.

    Simple. Ain't it? Here is a sample code.

    HTML :

    <div class="triangle"></div>

    CSS :

    .triangle{
      width: 0;
      height: 0;
      border-left: 50px solid transparent;
      border-right: 50px solid transparent;
      border-bottom: 100px solid red;
    }

    OUTPUT :

     

    Happy Coding :)

    CSS Triangle

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: