2014/12/15

Jak stworzyć Ghost Buttons, czyli przyciski z obramowaniem i przezroczystym tłem?


Demo

Ghost Buttons to proste przyciski posiadające przezroczyste tło, najczęściej z białym tekstem i obramowaniem, które umieszcza się na ciemnym tle-zdjęciu. Jest to mocny trend w designie stron i blogów tego roku. W tym poradniku zaprezentujemy kody css różnych rodzajów tych buttonów.

HTML

<a class="ghost-button" href="#">Tekst w przycisku duchu</a>

CSS

Styl1
.ghost-button {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 1px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
}
.ghost-button:hover,
.ghost-button:active {
background-color: #fff;
color: #000;
}
Styl2
.ghost-button-rounded-corners {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 1px solid #fff;
border-radius: 5px;
text-align: center;
outline: none;
text-decoration: none;
}
.ghost-button-rounded-corners:hover,
.ghost-button-rounded-corners:active {
background-color: #fff;
color: #000;
}
Styl3
.ghost-button-transition {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: background-color 0.2s ease-out,
color 0.2s ease-out;
}
.ghost-button-transition:hover,
.ghost-button-transition:active {
background-color: #fff;
color: #000;
transition: background-color 0.3s ease-in,
color 0.3s ease-in;
}
Styl4
.ghost-button-thick-border {
display: inline-block;
width: 200px;
font-weight: bold;
padding: 8px;
color: #fff;
border: 3px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: background-color 0.2s ease-out,
color 0.2s ease-out;
}
.ghost-button-thick-border:hover,
.ghost-button-thick-border:active {
background-color: #fff;
color: #000;
transition: background-color 0.3s ease-in,
color 0.3s ease-in;
}
Styl5
.ghost-button-semi-transparent {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: background-color 0.2s ease-out,
border-color 0.2s ease-out;
}
.ghost-button-semi-transparent:hover,
.ghost-button-semi-transparent:active {
background-color: #fff; /* fallback */
background-color: rgba(255, 255, 255, 0.4);
border-color: #fff; /* fallback */
border-color: rgba(255, 255, 255, 0.4);
transition: background-color 0.3s ease-in,
border-color 0.3s ease-in;
}
Styl6
.ghost-button-border-color {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: border-color 0.3s ease-out,
color 0.3s ease-out;
}
.ghost-button-border-color:hover,
.ghost-button-border-color:active {
color: #66d8ed;
border-color: #66d8ed;
transition: border-color 0.4s ease-in,
color 0.4s ease-in;
}
Styl7
.ghost-button-full-color {
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
background-color: transparent;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: color 0.3s ease-out,
background-color 0.3s ease-out,
border-color 0.3s ease-out;
}
.ghost-button-full-color:hover,
.ghost-button-full-color:active {
background-color: #9363c4;
border-color: #9363c4;
color: #fff;
transition: color 0.3s ease-in,
background-color 0.3s ease-in,
border-color 0.3s ease-in;
}
Styl8
.ghost-button-size-transition {
display: inline-block;
width: 200px;
height: 25px;
line-height: 25px;
margin: 0 auto;
padding: 8px;
color: #fff;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
transition: width 0.3s ease-out,
height 0.3s ease-out,
line-height 0.3s ease-out;
}
.ghost-button-size-transition:hover,
.ghost-button-size-transition:active {
width: 220px;
height: 45px;
line-height: 45px;
transition: width 0.1s ease-in,
height 0.1s ease-in,
line-height 0.1s ease-in;
}

Brak komentarzy :

Prześlij komentarz

Komentarze zawierające SPAM zostaną usunięte.

Szablon stworzony z przez Blokotka. Wszelkie prawa zastrzeżone.