CSS - How to make a rectangle with pointed sides?

http://nl.tinypic.com/r/jgm90h/8

I would like to know how to make an HTML button tag, have the form in the link above using pure CSS3. Can you guys help me?

+4
source share
1 answer

The trick is to use pseudo-classes :beforeand :after. Try this as follows:

.yourButton {
    position: relative;
    width:200px;
    height:40px;
    margin-left:40px;
    color:#FFFFFF;
    background-color:blue;
    text-align:center;
    line-height:40px;
}

.yourButton:before {
    content:"";
    position: absolute;
    right: 100%;
    top:0px;
    width:0px;
    height:0px;
    border-top:20px solid transparent;
    border-right:40px solid blue;
    border-bottom:20px solid transparent;
}

.yourButton:after {
    content:"";
    position: absolute;
    left: 100%;
    top:0px;
    width:0px;
    height:0px;
    border-top:20px solid transparent;
    border-left:40px solid blue;
    border-bottom:20px solid transparent;
}

JsFiddle: http://jsfiddle.net/VpW5x/

+6
source

Source: https://habr.com/ru/post/1540506/


All Articles