<input class="checkbox-cb" id="checkbox-cb" type="checkbox" />
<div class="cookie-bar">
<span class="message">This website uses cookies to give you an incredible experience. By using this website you agree to the <a href="#">terms</a></span>
<span class="mobile">This website uses cookies, <a href="#">learn more</a></span>
<label for="checkbox-cb" class="close-cb">x</label>
</div>
.cookie-bar {
position: fixed;
width: 100%;
top: 0;
right: 0;
left: 0;
height: 30px;
text-align: center;
line-height: 30px;
background: linear-gradient(lighten(red, 10%), darken(red, 10%));
color: white;
font-size: 14px;
font-family: "Lato", sans-serif;
font-weight: 100;
transition: .8s;
animation: slideIn .8s;
animation-delay: .8s;
.message {
white-space: nowrap;
text-shadow: 0 1px 0 darken(red, 10%);
@media (max-width: 767px){
display: none;
}
}
.mobile {
display: none;
@media (max-width: 767px){
display: inline-block;
}
}
}
@keyframes slideIn {
0% {
transform: translateY(-50px);
}
100% {
transform: translateY(0);
}
}
.close-cb {
border: none;
color: white;
background: darken(red, 20%);
position: absolute;
display: inline-block;
right: 10px;
top: 0;
cursor: pointer;
border-radius: 3px;
box-shadow: inset 0 0 3px 0 rgba(0,0,0,.2);
line-height: 30px;
height: 30px;
width: 30px;
font-size: 16px;
font-weight: bold;
&:hover {
background: darken(red, 10%);
}
}
.checkbox-cb {
display: none;
&:checked + .cookie-bar {
transform: translateY(-50px);
}
}
a {
color: rgb(92, 242, 255);;
}
View Compiled
// checkbox hack
// hit run to do it again.
// responsive -- shorter message for tablet/phones
This Pen doesn't use any external CSS resources.