Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Navigation button mouseover effect pops above nav bar

Posted on 2013-01-04
12
Medium Priority
?
339 Views
Last Modified: 2013-01-07
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
Comment
Question by:nsitedesigns
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 6

Expert Comment

by:stevepwales
ID: 38745128
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
 

Author Comment

by:nsitedesigns
ID: 38745164
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 38745861
for #nav li a:hover change padding to:
padding: 9px 18px 3px;

Cd&
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nsitedesigns
ID: 38747366
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
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 200 total points
ID: 38748591
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
 
LVL 43

Assisted Solution

by:David S.
David S. earned 1800 total points
ID: 38748899
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
 

Author Comment

by:nsitedesigns
ID: 38751161
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
 
LVL 43

Accepted Solution

by:
David S. earned 1800 total points
ID: 38751673
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
 

Author Comment

by:nsitedesigns
ID: 38751702
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
 
LVL 43

Expert Comment

by:David S.
ID: 38751802
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
 

Author Comment

by:nsitedesigns
ID: 38752010
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
 
LVL 43

Expert Comment

by:David S.
ID: 38752054
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question