Having trouble aligning the close X button in my cookie consent popup to the center?
I added a margin-top to adjust it, but I'm looking for a better solution.
<div class="alert cookiealert" >
By using our website you agree to our Cookie policy
<div class="acceptcookies">
<div class="x"></div>
</div>
</div>
.cookiealert {
position: fixed;
padding-left: 40px;
font-size: 14px;
bottom: 0;
left: 0;
width: 420px;
margin-bottom: 20px;
margin-left: 20px;
z-index: 900;
opacity: 0;
visibility: hidden;
border-radius: 50px;
transform: translateY(80%);
transition: all 500ms ease-out;
color: #000;
background-color: #ecf0f1;
}
.cookiealert.show {
opacity: 1;
visibility: visible;
transform: translateY(0%);
transition-delay: 1000ms;
}
.cookiealert a {
text-decoration: underline
}
.cookiealert .acceptcookies {
position: absolute;
display: inline-block;
margin-left: 25px;
}
.acceptcookies .x {
display: block;
position: fixed;
width: 12px;
height: 12px;
transition: transform .28s ease-in-out;
border-color: rgb(255, 255, 255);
}
.acceptcookies .x:hover {
transform: rotate(90deg);
}
.acceptcookies .x:before {
content: "";
position: absolute;
display: block;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 12px;
height: 0;
border-top: 1px solid rgba(0,0,0,0.5);
transform: rotate(45deg);
transform-origin: center;
}
.acceptcookies .x:after {
content: "";
position: absolute;
display: block;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 12px;
height: 0;
border-top: 1px solid rgba(0,0,0,0.5);
transform: rotate(-45deg);
transform-origin: center;
}
You can view the code here: https://codepen.io/m4573r00/pen/RwWEVWp