you see the “home” hyperlink? yeah, that is completely messed up:
<div id=“navi”>
<a href=“index.html” title=“our homepage”><div id=“home_on”></div></a>
</div> <!-- end of navi –>
i know i have a block level inside an inline right now, but it achieves what i need.
i tried to have the <a> within the <div id=“home_on”>, but then the link is NOT clickable.
then i tried changing the div to a span, but then it just disappears.
i tried to put the id attribute on the <a>, but then the link isn’t the EXACT size of the image.
this is what i need:
-i need the link area to be the exact same size as the image (img/home_on.jpg).
-i CANT use an <img> within the <a> because i need to have the image as a background image in .css for :hover effect reasons. that drop shadow will represent which page is on or when user hovers over other areas in the navigation
i can’t figure out how to get this done WITHOUT doing what i am doing right now which is have a block level element (div) within an inline (a). i want my markup to be validated so i can’t just leave it like this. someone please help!
ALso I feel you should know that by removing the outline (or rather, if doing Rays suggestion, hiding it) then you are removing an important accessibility feature for keyboard users because they will not be able to see what link they are on (unless they are clever and look at the status bar and put 2+2 together, assuming your links can do that) and they will be completely lost
yeah, it still gives the black dotted border in firefox when you release the left mouse button or right click on the link. not a big deal, but this is really bothering me.
also, it appears briefly in IE when right clicked and after left clicking.
yeah, i floated it right now since the element (JS image) under it i clear: both.
i caught that yesterday - it’s just sometimes i get so lazy that i want to finish it as fast as possible and if it is already floated left i get so insanely lazy i don’t even bother switching it. lol
Hi,
There is one other thing you might consider doing differently.
You have a large right margin on your #header and you are floating your ul#nav left.
You could also just nest the UL inside the header and remove the float and width form the header.
It would be much simpler to remove the header right margin and just float the ul right. I see you are using RP on the ul to line up the text in the last list item. That’s fine in this case since there are no other elements between the header and ul.
I agree Ryan, I do not advocate removing outline either.
yeah, it still gives the black dotted border in firefox when you release the left mouse button or right click on the link. not a big deal, but this is really bothering me.
What you are seeing in FF is a:focus
Hi,
There was no need for all those “off” classes in the nav. All you need to do is set up an “on” class for the current page and then set it on the anchor accordingly to each respective page.
Also no need to wrap a div around the UL, just set an ID on the UL and float it left.
anyway, one last real quick question about the nav: you know how when the links are :active it has that red border around it? well, im trying to get rid of that so i tried:
#nav a:active {
outline: none;
}
that got rid of the red border when active, but instead had a navy color dotted border in its place. i don’t want anything as a border when active. trying to go ultra minimalist in the design. thanks again man .
googled and forumed around for a while, but couldn’t find much other than “outline: none”.
Hi,
I’ll have to take a look at your page in a little while, I am busy at the moment.
There is a little bit more to than what the first example showed. It only showed how to get the current page highlighted on the first list item. I took it a little further and set up the current page class for all the links.
i need that code so that “home” “about” “services” “contact” are laid out horizontally next to each other. is it ok to have the anchor “block” when the anchor that is going to be block will be inside a <li> that is “inline”?
You would need to float the anchor left or right.
Even though you set the LI to display:inline and it rendered as such, technically the LI would still be seen as display:list-item according to doctype rendering.
Since you are dealing with images that have defined widths (and most likely different widths) I think you would be just as well to float both the LI and anchor. Then you can set widths on them to avoid the IE7 staircase bug.
also, concerning sprites: you just meant making two images stacked vertically (like two for “home” where one is drop shadow and one normal) into 1 image and then just switching from top-left to bottom-left on hover right?
Yes, a sprite image is a single image that has all states of the image. Depending on what your sprite image looks like, they are usually one single image that include all states of all the anchors in the nav menu.
You will need to use background positions set as px values in that case.
but if i make the anchor a block won’t that mess up the code i would need to lay it out horizontally?
#navi ul li {
display: inline;
}
i need that code so that “home” “about” “services” “contact” are laid out horizontally next to each other. is it ok to have the anchor “block” when the anchor that is going to be block will be inside a <li> that is “inline”? would this work and be valid xhtml 1.0? will the visual result be a navi that is laid out horizontally?
also, concerning sprites: you just meant making two images stacked vertically (like two for “home” where one is drop shadow and one normal) into 1 image and then just switching from top-left to bottom-left on hover right?
-i CANT use an <img> within the <a> because i need to have the image as a background image in .css for :hover effect reasons. that drop shadow will represent which page is on or when user hovers over other areas in the navigation
So you are going to have more links, then you need to use a UL like I mentioned above.
You should also be using a sprite image on the anchor and just change the BG position on hover. That way the hover state is preloaded and it just changes position on hover.