Archived topic
How to Add Close option in Top Bar
3 replies · Started by sandeep kumar on July 12, 2021
Hi
How to Add Close option (X) in Top Bar right.
my current css
/* Align text and button horizontally */
.top-bar-cta {
display: flex;
align-items: center;
}
/* Add space to right of text */
.top-bar-cta-text {
margin-right: 20px;
}
/* Style button */
a.top-bar-cta-button {
border-radius: 4px;
padding: 8px 16px;
background-color: #fff200;
color: #000;
}
/* Style button on hover */
a.top-bar-cta-button:hover {
background-color: #ffa502;
color: #fff;
}
.top-bar
{
position: -webkit-sticky;
position: sticky;
z-index: 999;
top: 0;
left: 0;
right: 0;
}
.top-close-button {
float: right;
clear:right;
margin-top: -20px;
cursor: pointer;
}
body, div#wpadminbar, .top-bar {
transition: transform 500ms ease;
}
Thanks
Hi there,
it requires more than CSS as the browser would need to record the fact the top bar was dismissed or it will just re-appear on page link or refresh. It would require custom development to do that - the most i can offer is the experimental method i provided here:
https://generatepress.com/forums/topic/close-button-for-elements/#post-1537420
But as i said its custom development which falls out of this forums scope.
Thanks David
You're welcome