April 4, 2012

How to create an arrow in css3?

Question by Rohit Azad

How to create arrow in css3?
As like this .

enter image description here

enter image description here

jsfiddle http://jsfiddle.net/BdSP4/1/

Answer by Starx

Just adding alternative using CSS3’s rotate

Demo

CSS

.arrow { width: 20px; height: 20px; overflow: hidden; }
.arrow span  {
    display: block;
    border: 4px #000 solid;
    background: #fff;
    width: 14px;
    height: 14px;
    float:right;
    margin-right: -12px;

    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    filter: progid:DXImageTransform.Microsoft.Matrix(
         M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476, sizingMethod='auto expand');
    zoom: 1;
}

HTML

<div class="arrow"><span></span></div>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!