• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Navigation button mouseover effect pops above nav bar

Stupid question.  How do I get the blue mousever effect to display above nav bar?  The nav bar div tag seems to be blocking it from going above.

html
http://nsitedesigns.com/nsitedesigns/cbrf/test.html

screenshot
http://screencast.com/t/pmCFtkT7PoI
0
nsitedesigns
Asked:
nsitedesigns
  • 5
  • 4
  • 2
  • +1
3 Solutions
 
stevepwalesCommented:
Set the nav bar div to relative the other the absolute and use a the position top to set how far above you want it
0
 
nsitedesignsAuthor Commented:
Set the nav bar div to relative the other the absolute and use a the position top to set how far above you want it

What do you mean "the other the absolute"
0
 
COBOLdinosaurCommented:
for #nav li a:hover change padding to:
padding: 9px 18px 3px;

Cd&
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
nsitedesignsAuthor Commented:
COBOLdinnie

I did what you suggested but it didn't work.  The div tag isn't letting the nav blue bar extend UP beyond the div tag, it is pushing the blue extention DOWN and the text is moving down with it.  Do I need to increase the height of the div?
0
 
COBOLdinosaurCommented:
Yeah it looks like with that transitional doctype, it will need the height increased as well for the #nav li a:hover rule... or you could try setting line-height to a larger value.

Also try setting z-index:10 to make sure it stays on top.

Cd&
0
 
David S.Commented:
Since browsers are not using "quirks mode", the doctype is not the issue here. (Though I consider XHTML 1.0 Transitional to be fairly obsolete.)

There are two issues here. The first is that "#nav" has "overflow:hidden" which will hide the top of the links, since you want them to extend beyond the top of the bar. To keep "#nav" from collapsing to 0 height, you can float it and give it 100% width instead.

The second thing is that increasing the top padding alone will only shift the link down. If you want the top to move up to account for the increase in top padding, you need to use a negative top margin. (And to avoid problems in older versions of IE, it's best to give "position:relative" to elements with a negative margin.)

#nav li a {
color:#fff;
font-weight:bold;
display:block;
padding:4px 18px 3px 18px;
text-decoration:none;
position: relative;
}	

#nav li a:hover {
   color: #fff;
   background-color: #809eb2;
padding: 9px 18px 3px;
margin-top: -5px;
    }

Open in new window

0
 
nsitedesignsAuthor Commented:
Kravmir,

I tried your solution and it worked on the main nav bar.  However, when I tried to bump it up to -8px on the margin-top for the #nav li a:hover it showed part of the main nav bar on the bottom margin.  In other words, the mouseover moved up but so did the bottom of the mouseover button.  Any idea how to fix that?

In addition, my drop downs now have this same effect applied, namely a large top margin.  I went into #nav li:hover ul {display:block;} and put a margin-top of 0px but that didn't fix it so I took it back out.  

Here is link to test document.
http://nsitedesigns.com/nsitedesigns/cbrf/test1.html

p.s.  Is Dreamweaver CS4 THAT outdated that I should be worried?
0
 
David S.Commented:
To increase the negative top margin, you would need to increase the top padding as well. So in this case the padding would be "padding: 12px 18px 3px".

The margin was not given to <ul>s; it was given to <a>s. Add this new rule to your stylesheet:
#nav li ul li a:hover {
	margin-top: 0;
	padding: 4px 18px 3px;
}

Open in new window

The editor is (or at least should be) irrelevant. Don't let your editor make decisions about your markup for you. I assume there is a way to use whatever doctype you choose in DreamWeaver. This seems to give information on that: http://forums.adobe.com/thread/886172
0
 
nsitedesignsAuthor Commented:
Kravmir,

You stated, "... I consider XHTML 1.0 Transitional to be fairly obsolete."  What would you suggest?  

I will try modifying the code you recommended shortly.
0
 
David S.Commented:
I recommend the HTML5 doctype, regardless of how many new HTML5 features you intend to use at present.
<!DOCTYPE html>

Open in new window

I also recommend that you start using some of the new HTML5 input types, especially "number", "email", "url", and "tel", since they are quite helpful when using mobile devices (and those 4 types gracefully degrade to "text" in older browsers).
0
 
nsitedesignsAuthor Commented:
Thanks.  

Maybe this is another question, if so, let me know.

I understand you recommend I not use the following which automatically comes up when I open a new page in Dreamweaver CS4

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I don't understand what I replace?  Does all this get replaced with <!DOCTYPE html>
0
 
David S.Commented:
Yes. The older doctypes included a lot more information, but it was decided that it was really not necessary for HTML documents, so they made the new much shorter document type declaration.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now