SCSS
by Oleh Kotsubko
HTML
<div id="banner-message">
<p>Hello World</p>
<button class="flex">Hover to change color</button>
<button class="inline-flex">Hover to change color</button>
</div>
SCSS
@mixin flex($display: flex, $justify-content: flex-start, $align-items: flex-start, $direction: row, $wrap: nowrap) {
display: $display;
justify-content: $justify-content;
align-items: $align-items;
flex-direction: $direction;
flex-wrap: $wrap;
}
$blue: #0084ff;
$blue-darker: darken($blue, 5);
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
button {
background: $blue-darker;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
&:hover {
background: $blue-darker;
color: #fff;
margin-top: 40px;
width: 200px;
}
&:hover button {
background: #fff;
color: #000;
}
}
.inline-flex {
@include flex(inline-flex, center, center, row, wrap);
}
.flex {
@include flex(null, center, center, row, wrap);
}