Make a Triangle in CSS

Making a triangle is a little harder than making a square or rectangle in CSS. Here is what you do. First set up your div, we are going to give our div and id of triangle.

[code]<div id="triangle"></div>[/code]

Now we will add the CSS for the triangle.

[code]<style>
#triangle{
width: 0;
height: 0;
border-style: solid;
border-width: 0 100px 100px 100px;
border-color: transparent transparent #33ff00 transparent;
}</style>[/code]

Only cool people share!

Make a Triangle in CSS

That is how you make a triangle in CSS.  We gave this particular triangle the background color of green.  Here is a really cool website that will help you make CSS triangles. It is called the CSS triangle generator.

You can also turn the triangle up, down and sideways. See Chris Coyier’s article on css triangles here.

Make a Triangle in CSS was last modified: May 22nd, 2015 by Maximus Mccullough
Summary
Make a Triangle in CSS
Article Name
Make a Triangle in CSS
Description
Making a triangle is a little harder than making a square or rectangle in CSS. Here is what you do. First set up your div, we are going to give our div and id of triangle.
Author
create-a-triangle-with-css

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.