Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > HTML, XHTML and CSS

Reply
 
LinkBack Thread Tools
Old August 12th, 2009, 10:09 AM   #1
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Strange issue with CSS menu - image rollover

Hi,

I'm trying to set up my (very basic, horizontal, no dropdown) CSS menu so that when a user hovers over the menu link items, the formatting changes and they basically get an image on mouseover (nothing more than changing the text colour and adding a curve on the left hand side, so it just looks like a selected tab).

It kind of works but instead of the whole image showing it only shows in the area where the menu link text is, so instead of covering the height of the menu bar and a length I specify, it's just covering the actual word e.g "Home" in each case on the menu.

I can't seem to get it so that on rollover the whole image shows. I've tried setting it so that the links have a background image (just a plain block from the nav bar) but that doesn't work.

My CSS is:

/* this is the bar where the menu is located */
.menuholder {
width:1001px;
height:2.19em;
background-color:#0f2763;
}

/*holder for the menu */
div.navigation {
margin-left:30px;
padding-top:10px;

}
.navigation ul {
list-style-type: none;
position: relative;
float: left;
}

.navigation ul li {
display: block;
padding: 0px 20px 0px 10px;
display: inline;
height:2.19em;
}

.navigation ul li a {
font-family:Arial, Helvetica, sans-serif;
color:#FFF;
font-size:14px;
font-weight:bold;
line-height:18px;
width:100px;
height:2.19em;
text-decoration:none;
}

.navigation ul li a:hover {
color:#0f2763;
background-image:url(/images/menutab.gif); width:100px; height:2.19em;
}

I've tried setting display:block; and float:left; on the .navigation ul li, but this makes the menu become vertical and throws the whole page out of sync.

I tried this altrnative code, to no avail:

.menuholder {
width:1001px;
height:2.19em;
background-color:#0f2763;
}

div.navigation {
margin-left:30px;
padding-top:10px;
height:2.19em;

}
.navigation ul {
list-style-type: none;
position: relative;
float: left;
}

.navigation ul li {
padding: 0px 20px 0px 10px;
display: block;
float:left;
height:2.19em;
}

.navigation ul li:hover {
color:#0f2763;
background-image:url(/images/menutab.gif); width:100px; height:2.19em;
background-repeat:no-repeat;
}

.navigation ul li a {
font-family:Arial, Helvetica, sans-serif;
color:#FFF;
font-size:14px;
font-weight:bold;
line-height:18px;
width:100px;
height:2.19em;
text-decoration:none;
display: inline;
}

Any ideas or pointers gratefully received!
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 12th, 2009, 11:43 PM   #2
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Strange issue with CSS menu - image rollover

that is some extremely messy css man,

I wasn't really sure what you were going for with the way you wrote this, but I think I got the job done.
(if this doesn't work then private message me and we can talk on aim or something to get this fixed)


/* this is the bar where the menu is located */
#menuholder {
position: relative;
width:1001px;
height:2.19em;
background-color:#0f2763;
}

#menuholder div.navigation {
margin-left:30px;
padding-top:10px;
}

#menuholder div.navigation ul {
list-style-type: none;
margin: 0;
}

#menuholder div.navigation li {
position: relative;
float: left;
display: block;
padding: 0px 20px 0px 10px;
height:2.19em;
}

#menuholder div.navigation a {
position: absolute;
font-family:Arial, Helvetica, sans-serif;
color:#fff;
font-size:14px;
font-weight:bold;
line-height:18px;
width:100px;
height:2.19em;
text-decoration:none;
}

#menuholder div.navigation a:hover {
color:#0f2763;
background:url(/images/menutab.gif) no-repeat;
}



the html will look like this:

<div id="menuholder">
<div class="navigation">
<ul>
<li><a href="#">link1</a></li>
<li><a href="#">link2</a></li>
<li><a href="#">link3</a></li>
<li><a href="#">link4</a></li>
<li><a href="#">link5</a></li>
</ul>
</div>
</div>
colmustard is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 13th, 2009, 03:54 AM   #3
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Re: Strange issue with CSS menu - image rollover

Thanks for the reply, think I have it sorted now though, by tweaking the padding...

Have a different issue now with the image not showing entirely for the list items that have less characters (e.g Home) however that's a separate issue I guess.

Thank you
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 13th, 2009, 12:17 PM   #4
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Strange issue with CSS menu - image rollover

Hi Galad,

Well if the entire image isn't showing then this is a css issue as well, but I need to see exactly how you set up your menu navigation bar in terms of the html in order to fix it without breaking anything else.
colmustard is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 14th, 2009, 09:35 AM   #5
WebForumz Member
 

Join Date: Apr 2008
Location: USA
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 galahad3 is on a distinguished road
Re: Strange issue with CSS menu - image rollover

Managed to crack it, by ditching the menu system I was using and redoing it so it looked the same but with multiple li classes which works perfectly...
galahad3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 14th, 2009, 04:16 PM   #6
New Member
 

Join Date: Aug 2009
Location: United States
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 colmustard is on a distinguished road
Re: Strange issue with CSS menu - image rollover

Ahhh, gratz then, and best of luck with the site
colmustard is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
issue with menu spacing/image centering sarah22 Your Design and Layout 2 April 19th, 2009 05:38 PM
Strange table cell height issue niko79 HTML, XHTML and CSS 16 June 5th, 2008 06:14 AM
[SOLVED] multiple image rollover not restoring image snappy JavaScript 4 November 5th, 2007 10:38 AM
strange refresh issue....(IE and FF) konnor5092 HTML, XHTML and CSS 12 April 2nd, 2007 12:25 PM
Rollover navigation menu SJMAC HTML, XHTML and CSS 14 February 7th, 2007 10:07 AM


Search Engine Optimization by vBSEO 3.2.0 RC8