Saturday, July 18, 2015

Create arrow with CSS

Sometime you need create some shape by CSS3. I have some code to do it.

#base {
  background: red;
  display: inline-block;
  height: 30px;
  margin-left: 20px;
  margin-top: 55px;
  position: relative;
  line-height: 30px;
   padding: 0 10px;
}
#base:before {
  border-left: 15px solid red;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;  
  content: "";
  height: 0;
  left: 0;
  float:right;
  margin-right: -25px;
  width: 0;
}

CSS for Circle
#circle {
 width: 100px;
 height: 100px;
 background: red;
 -moz-border-radius: 50px;
 -webkit-border-radius: 50px;
 border-radius: 50px;
}

Triangle Right

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



No comments:

Post a Comment