Create a Button with right triangle/pointer

后端 未结 2 1285
闹比i
闹比i 2021-01-13 07:32

Looking to create this: \"button

What would be the best way to achieve it?

2条回答
  •  粉色の甜心
    2021-01-13 08:13

    You may this in your HTML;

    
    

    And this in your CSS

    a {
        background: #950006;
        border: none;
        display: inline-block;
        height: 28px;
        line-height: 28px;
        position: relative;
        text-decoration: none;
        width: 100px
    }
    
    a:before{
        background: #950006;
        border: none;
        content: '';
        display: block;
        height: 20px;
        left: 90px;
        position: absolute;
        top: 4px;
        -moz-transform: rotate(45deg);
        -webkit-transform: rotate(45deg);
        -o-transform: rotate(45deg);
        transform: rotate(45deg);
        width: 21px;
    }
    a button {
        color: #fff;
        background: none;
        border: none;
        font-weight: bold;
        position: relative;
        width: 120px;
        height: 28px;
    }
    

    and will output a button like this:- enter image description here

    Here is a working Live Demo. The complete button is CLICKABLE. You may test the button by changing the background of the parent div.

    Hope this helps.

提交回复
热议问题