CSS Triangle

- 1 min

I saw a blog which talked about how to make a css triangle. Through simple box model, we could build css triangle.

Here is my note.

.css-initial-box {
  width: 100px;
  height: 100px;
  padding: 16px;
  border: 12px solid transparent;
  border-top-color: red;
  border-right-color: green;
  border-bottom-color: blue;
  border-left-color: purple;
}

.css-square {
  width: 0px;
  height: 0px;
  border: 112px solid transparent;
  border-top-color: red;
  border-right-color: green;
  border-bottom-color: blue;
  border-left-color: purple;  
}

.css-bottom-triangle {
  width: 0px
  height: 0px;
  border-bottom: 112px solid blue;
  border-left: 112px solid transparent;
  border-right: 112px solid transparent;
}
Vic Yang

Vic Yang

Back-end Engineer

comments powered by Disqus
rss facebook twitter github youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora