I’m only working w/2 states on this, but having trouble making it work vertically. You’ll see that between each button is a vertical gap that I would like to be dead space (not clickable). In addition, I can’t for the life of me get the default text to be hidden and I can’t understand how he does it.
You’ll see that between each button is a vertical gap that I would like to be dead space (not clickable).
Hi Ken,
From looking at your ul id #nav you have not removed the default margins and paddings that browsers apply to a ul.
In addition, I can’t for the life of me get the default text to be hidden and I can’t understand how he does it.
Well, you left out the “b” tag that the text is wrapped in. That is what hides the text. The “b” tag is given absolute positioning and a negative z-index via the css.
Look back at the tut and look for those b tags in both the css and html.
This selector is saying “target the b tag which is found in the anchor” -
#nav a b {
[B]position:absolute; /* the magic */[/B]
left:0;top:0; /* the magic */
[B]z-index:-1; /* the magic */[/B]
height:50px; /* same height as anchor */
width:150px; /* same width as anchor */
line-height:50px; /* more style */
text-align:center; /* more style */
}
I was trying to understand the “b” tag stuff and see your quick update, but look back at the original link I posted to Eric’s demo and none of that stuff is there.
After resetting your ul you will also need to add margin to your li if you want dead space between the anchors.
This gets it close
#nav li {
float:left;
[B]margin:5px 0;[/B]
}
You will probably need to define a height on your anchor to get things pixel perfect with your sprite.
I was trying to understand the “b” tag stuff and see your quick update, but look back at the original link I posted to Eric’s demo and none of that stuff is there.
Yes, it’s there. Look at the second example ( …Or Even Better!) called the “Spriteric” lower down the page.
You just made your anchor 360px high. That’s bigger than your menu.
Look at Eric’s 2nd example on the tut page and look at the html. The b tag is highlighted in bold text. You still have not got it in your html yet so it is not doing anything.
The b tag is just the “bold” tag. It is an inline element so it will legally nest within the anchor. It is just for hooking the absolute positioning and negative z-index to.
When you copy and paste other peoples code it is always important to adapt it to your project.
Adapting? I was adapting - I did take it from horiz. to vert. and figure out the extra top margin didn’t I? I could have adapted for weeks and never understood why a bold tag (not in the original example) was being used until you said “It is just for hooking the absolute positioning and negative z-index to.” Now I see it’s a “trick”.
Still, if you go to Eric’s example I originally “adapted” from http://www.visibilityinherit.com/code/nav20.php and search for every letter “b” in the code, there’s no “#nav a b” to be found.
Now my next issue is an unbelievably easy float problem… that is for you guys. For me, I’m reading Floatutorial over and over again and can’t figure it out…:injured:
Ken, there is one more thing you need to do. You need to set the “b” height and line-height the same as your anchor height. It will just keep things looking uniform if the image is disabled. Which is the whole purpose of that text replacement method. I set the color as white on the anchor also.
It’s saying your targeting a “b” nested in a “a” nested in the #nav. If your uncomfortable with that image replacement method you can just get rid of all the b stuff and just use text-indent:-999em instead. The b stuff only caters for pepole with images off and css on, which probably is not much.
Now I understand that #nav a b could have also been #nav a i or other possibilities. But with a meaning “active” and ID’s of a, b, c,… etc., the letters were getting confusing. (:
I could tell from the comments in the css, I just reworked it yesterday.
Rather than taking a min-max/elastic layout and adapting it into a fixed width layout you would have been better off choosing a fixed width layout to begin with. http://www.css-lab.com/demos/2col/2col-equal.html
After you set a fixed width on that elastic layout it defeated the logic behind the layout’s structure and left the IE6/7 fixes kinda meaningless (though they are still needed with your template).
They could have gained “haslayout” from the defined widths of the fixed width layout. It also left the “clearfix” float containment unnecessary for good browsers since they get the child floats (left & content) contained by the floated parent (innerwrap) in that fixed width layout.
You also have an ID of the same name being used twice on that page. ID’s are unique and they can only be used once in a page.
First, I would like to take this opportunity to put a shout out to CSS Lab and it’s talented and modest owner, Ray Hopson. Take a bow Ray. Remember to visit CSS Lab for all your CSS layout example needs.
Sure that’s your layout! If I wanted to hide that I would have pulled all the comments and mucked up the code a bit.
Sure I know ID’s have unique names. I’m just sloppy.
I started by trying my own layout and getting into trouble, so I looked for a good way out. I’m not surprised I took the wrong way out, are you?
Sure that’s your layout! If I wanted to hide that I would have pulled all the comments and mucked up the code a bit.
No need to hide or muck anything.
"I hope you find these demos useful and that they will help you learn more about structuring CSS layouts…
The opening statement is an invitation to all who need something to build on.
There is not any techniques being used in the demos that I can take full credit for. In fact you will find credit links in several of them.
I just try to put my own twist on them and keep the code lean.
I started by trying my own layout and getting into trouble, so I looked for a good way out. I’m not surprised I took the wrong way out, are you?
The reason there are so many different variations (fixed/fluid etc.) is because they all require a different approach and IE workarounds (mainly IE6/7). Some require more html/css than others to accomplish the goal. It is always best to keep your code to a minimum and not have styles lying around that are not doing anything.
I have been slowly working my way through them and cleaning up the code and deleting some of them completely. It is time consuming but I hope to get them all as clean as possible.
I look back on some of them that I made when I was first learning and I am finding a lot of things that are a bit bloated.