Reputation: 2277
I'm trying to show an background image with some text inside when im hoovering the navigation link, but for some reason the image wont show up.
Here some of the title css
.navigation h1 {
position: absolute;
right: 22px;
top: -7px;
display: none;
padding: 4px 20px 4px 7px;
color: #fff;
white-space: nowrap;
background: transparent url('http://i.imgur.com/dbnCNPk.png') 100% 50% no-repeat;
}
HTML
<div class="navigation">
<ul>
<li>
<h1>one</h1>
<a href="#hem" class="active">one</a> </li>
<li> <h1>two</h1>
<a href="#two">two</a></li>
<li> <h1>three</h1>
<a href="#three">three</a></li>
</ul>
</div>
And a Fiddle
Upvotes: 1
Views: 1569
Reputation: 20442
.navigation h1 {
position: absolute;
right: 22px;
top: -7px;
display: none; /* <-- were you expecting some magic ? */
...
}
Your css makeover seems a little messed up. You only 'hover' declaration is :
.navigation a:hover{
border-radius:25px;
background-color:#f68A33;
}
witch will NOT achieve what you want. It just manage the A tag.
So, if you want some action to happen on the tag, you will have to scope it.
h1 { remove the display:none; h1 is block-level by default}
h1.hover {do your background thing here }
Upvotes: 1
Reputation: 325
you can user hover in css as :
.navigation h1:hover {
background: transparent url('http://i.imgur.com/dbnCNPk.png') 100% 50% no-repeat;
}
and adjust the position.
Upvotes: 1
Reputation: 110
You could change the display of the h1 on hover
.navigation:hover h1 {
display: block;
}
Upvotes: 1
Reputation: 2033
Check out the fiddle.
You didn't have a hover class to show the h1. I added:
.navigation li:hover h1 {
display:block;
}
I have actually updated it again:
This time I added:
top: -35px;
for the h1
and put
positon: relative;
for the li
Upvotes: 5