I'm trying to figure out why my CSS button has such a large clickable area. Is there a way to reduce it? When I hover over the button, the clickable area extends beyond the text, which is not ideal. Any suggestions on how to fix this without altering the CSS directly would be helpful.
Thank you.
CSS:
/*BUTTONS*/
#button-container {
width: 900px;
height: 35px;
}
.button-text {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
line-height: 10px;
color: #FFF;
padding-top: 0px;
padding-bottom: 0px;
margin-left: 10px;
}
.menu,
.menu ul,
.menu li,
.menu a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.menu {
height: 31px;
width: 900px;
}
.menu li {
position: relative;
list-style: none;
float: right;
display: block;
height: 21px;
}
.menu li a {
display: block;
padding: 0 0px;
padding-right: 15px;
margin: 25px -59px;
margin-right: 12px;
line-height: 22px;
text-decoration: none;
background-image: url (button-background.png);
background-repeat:no-repeat;
background-position:center;
height:27px;
width:105px;
background-position:46px -1px;
background-size:69px 24px;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 14px;
color: #000000;
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
text-align: right;
text-align: right;
text-align: right;
text-align: right;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a {
color: #FF6C6C;
}
.menu ul {
position: absolute;
top: -109px;
left: 0;
opacity: 0;
background: #1f2024;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .10s ease .1s;
-moz-transition: opacity .10s ease .1s;
-o-transition: opacity .10s ease .1s;
-ms-transition: opacity .10s ease .1s;
transition: opacity .10s ease .1s;
}
.menu li:hover > ul { opacity: 1; }
.menu ul li {
height: 0;
overflow: hidden;
padding: 0;
}
.menu li:hover > ul li {
height: 36px;
overflow: visible;
padding: 0;
}
.menu ul li a {
width: 36px;
padding: 10px 0 1px 10px;
margin: 0;
border: none;
border-bottom: 0px solid #353539;
}
.menu ul li:last-child a { border: none; }
HTML
<div class="button-container"><ul class="menu">
<li><a href="/index">INDEX</a></li>
<li><a href="/category/2/">DINO</a></li>
<li><a href="/category/1/">LIONS</a></li>
</ul>
</div>
EXAMPLE:
http://jsfiddle.net/#&togetherjs=vSgITe2BmT
Thanks !!