CSS3 arrow hyperlink

后端 未结 2 1822
梦如初夏
梦如初夏 2021-01-16 23:03

Trying to make arrow link with CSS. This one works in Firefox, but has a problems in IE and webkit-based browsers with arrowhead\'s position. Double div used for centering l

2条回答
  •  执念已碎
    2021-01-16 23:47

    Try this code -- >
    HTML :

    content
    Link
    content

    CSS :

    a{
        padding:10px;
        background:#2ecc71;
        display:inline-block;
        position:relative;
    }
    a:hover{
        background:orange;
    }
    a:hover:after{
       border-left: 20px solid orange;
    }
    a:after {
    display: inline-block;
    content: "";
    width: 0;
    height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-left: 20px solid #2ecc71;
    position: absolute;
    right:-20px;
    top:0;
    
    }  
    

    JS FIDDLE DEMO

    The border width and the right and top positions can be tweaked according to your needs

提交回复
热议问题