Skip to content

Instantly share code, notes, and snippets.

@fff
Created November 15, 2012 14:57
Show Gist options
  • Save fff/4079032 to your computer and use it in GitHub Desktop.
Save fff/4079032 to your computer and use it in GitHub Desktop.
A CodePen by fff. how to draw one triangle with div - draw a triangle only with css+div.
.aa
.a
.a.b
.a.b.c
.a.b.c.d
.a.b.c.d.e
.clear
.label "thin boader div"
.label "fat boader div"
.label "div with 3 boaders"
.label2 "0 size div"
.label2 "div with 2 boaders"
.label2 "triangle"
div{
display: inline-block;
margin: 10px;
}
.label{
width: 100px;
}
.label2{
width: 80px;
}
.clear{
display: block;
}
.aa{
border: black solid 10px;
height: 80px;
width: 80px;
}
.a{
border: black solid 40px;
height: 20px;
width: 20px;
}
.b{
border-right: transparent solid 40px;
}
.c{
height: 0px;
width: 0px;
}
.d{
border-left: transparent solid 40px;
}
.e{
border-top: transparent solid 40px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment