How Do I Make The Hover Background Color Fill The Height Of The Link?
How do I make the hover background-color fill the entire height of the navigation bar plus the padding of the text instead of only the text. I want to make it look like this. Fid
Solution 1:
Here you go. I've created a jsfiddle for you. Its working good:
Updated CSS:
<style>.fa {
font-size: 15px;
margin-top: -10px;
margin-bottom: -10px;
}
.navbar-height {
height: 65px;
}
.clearboth {
clear: both;
}
/* workbar styles */.fixed-top {
position: fixed;
top: 0;
right: 0;
left: 0;
background: #FFF;
text-align: center;
height: 67px;
margin: 0 auto;
width: 100%;
}
.workbar {
text-align: center;
margin: 0 auto;
background-color: #ffe6e6;
}
.worknav {
list-style: none;
padding-left: 0px;
margin: 0 auto;
text-align: center;
}
.worknav> li {
text-align: center;
display: inline-block;
padding-left: 20px;
padding-right: 20px;
padding-top: 11px;
padding-bottom: 11px;
}
.worknav> li:hovera {
color: yellow;
}
.worknav>li:hover {
background-color: black;
}
.worknav > li > a {
text-decoration: none;
color: #666;
}
.centered {
float: none;
margin-left: auto;
margin-right: auto;
}
.worktop {
margin-top: 70px;
}
</style>
Solution 2:
If you wish to colour both the padding and the text try something like:
a:hover{
background-color:yellow;
color:red;
}
Solution 3:
Try to do Anchor link css as
.worknav > li > a {
text-decoration: none;
display:inline-block;
color: #666;
line-height:65px;
}
Solution 4:
You can do it by applying padding on anchor tag. Remove height on ul and li tag and instead of height just apply padding on anchor. And also apply background-color on anchor.
It will work i think. If I am right then let me know i'll share some code if you want.
Post a Comment for "How Do I Make The Hover Background Color Fill The Height Of The Link?"