Button with different format with CSS

Asked

Viewed 76 times

2

I needed to make a button with css plus it has a different format.

It is possible to make a button like this only with css

inserir a descrição da imagem aqui

2 answers

3

Kirito I tell you to do with linear-gradient, so the corner is transparent and even the background feel an image you can see without problems.

body {
    background-image: url(http://unsplash.it/300/300);
    background-size: cover;
    background-repeat: no-repeat;
}
.canto {
    background-image: linear-gradient(45deg, black 0%, black 90%, transparent 90%);
    width: 200px;
    height: 80px;
    line-height: 80px;
    text-align: center;
    color: peachpuff;
    font-size: 2rem;
    font-family: sans-serif;
}
<div class="canto">Meu BTN</div>

  • Uhhhh, is this an example snippet or is this a mistake?

  • @I_like_trains I think is a snippet error because everyone give the same problem, at least here for me....

  • 1

    Yes, I’ve noticed several responses, but good answer

  • @I_like_trains thanks :D

1

Yes, it is possible. You can do so:

div {
    height: 50px;
    background: #0099d9;
    position: relative;
    width:300px;
}

div:before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    border-top: 20px solid white;
    border-left: 20px solid #0099d9;
    width: 0;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.