I have a created an <a> element that links to JavaScript, but I want it to look like a button.
<a href="javascript:void(0)" id="closebtn" onclick="closeNav()">×</a>
Here is the CSS code:
#closebtn {
border-radius: 100%;
position: absolute;
font-size: 50px;
text-align: center;
width: 48px;
height: 48px;
top: 100px;
right: 45px;
padding: 5px;
}
#closebtn:hover {
background-color: #5c564f;
color: #FFF6EA;
padding: 3px;
border: 2px solid #FFF6EA;
}
I have centered it horizontally using text-align
, but the X symbol is not perfectly aligned in the middle of the circular "button." Is there a way to achieve this?
I attempted using justify-element, but since I am working with <a> and not <button> or <div>, I am finding it challenging. There must be a simple solution that I am missing.