LSJ
05-13-2009, 07:45 PM
Hi everyone,
This is my first post, and I'm afraid it's gonna be a long one. A while back I discovered the navigation matrix technique in a book called The Art & Science of CSS. The same sort of thing is described here: http://superfluousbanter.org/archives/2004/05/navigation-matrix/, although it's not the exact same example they used in the book.
I have used it successfully for horizontal menus several times. Now I am trying to create a vertical menu using the same technique, and it's not working. I'm hoping that someone here might be able to point out what I'm missing, or, if it's impossible to do maybe someone can explain why. If I can make this work it will come in handy a lot, especially when working with graphic designers who love fancy fonts...
First I'll paste in the code & image from the horizontal version, which is working fine:
XHTML
<ul id="navlist">
<li id="hm"><a href="#" id="urhere">HOME</a></li>
<li id="abt"><a href="about.html">ABOUT</a></li>
<li id="wrk"><a href="work.html">WORK</a></li>
<li id="cntct"><a href="contact.html">CONTACT</a></li>
</ul>
CSS
/*For Main Navigation*/
#navlist {
width: 298px;
height: 31px;
position: relative;
background: url(../images/main_nav.jpg);
margin: 10px 0px 0px 0px;
padding:0;
list-style-type:none;
}
#navlist li {
float: left;
}
#navlist li a {
position: absolute;
top:0;
margin:0;
padding:0;
display: block;
height: 30px;
background: url(../images/main_nav.jpg) no-repeat;
text-indent: -9999px;
overflow: hidden;
font-size: 1%;
}
li#hm a {
left: 0px;
width: 70px;
background-position: 0px 0px;
}
li#abt a {
left: 70px;
width: 70px;
background-position: -70px 0px;
}
li#wrk a {
left: 140px;
width: 70px;
background-position: -140px 0px;
}
li#cntct a {
left: 210px;
width: 88px;
background-position: -210px 0px;
}
li#hm a:hover {
background-position: 0px -31px;
}
li#abt a:hover {
background-position: -70px -31px;
}
li#wrk a:hover {
background-position: -140px -31px;
}
li#cntct a:hover {
background-position: -210px -31px;
}
#hm #urhere {
background-position: 0px -62px;
}
#abt #urhere {
background-position: -70px -62px;
}
#wrk #urhere {
background-position: -140px -62px;
}
#cntct #urhere {
background-position: -210px -62px;
}
IMAGE (298px wide by 93px high)
http://www.lauriesterlingjensen.com/test/phylliswongdesign2/images/main_nav.jpg
And here is the code and image for the vertical version, which is not working:
XHTML
<ul id="subnavlist">
<li id="prnt"><a href="#" id="current">Print</a></li>
<li id="brnd"><a href="michigan.html">Brand</a></li>
<li id="msc"><a href="solar.html">Miscellany</a></li>
</ul>
CSS
/*For Secondary Navigation*/
#subnavlist {
position:relative;
width:91px;
height:90px;
margin:0;
padding:0;
background: url(../images/sub_nav.jpg);
list-style-type:none;
}
#subnavlist li {
float:left
}
#subnavlist li a {
position:absolute;
top:0;
margin:0;
padding:0;
display:block;
height: 30px;
width: 91px;
background: url(../images/sub_nav.jpg) no-repeat;
text-indent: -9999px;
overflow: hidden;
font-size: 1%;
background-attachment:fixed;
}
li#prnt a {
left:0;
width:91px;
background-position:0px;
}
li#brnd a {
left:0;
width:91px;
background-position:0px;
}
li#msc a {
left:0;
width:91px;
background-position:0px;
}
li#prnt a:hover {
background-position:-91px 0;
}
li#brnd a:hover {
background-position:-91px 0;
}
li#msc a:hover {
background-position:-91px 0;
}
#prnt #current {
background-position: -182px 0;
}
#brnd #current {
background-position: -182px 0;
}
#msc #current {
background-position: -182px 0;
}
IMAGE (273px wide by 90px high)
http://www.lauriesterlingjensen.com/test/phylliswongdesign2/images/sub_nav.jpg
Thanks for reading!
P.S. Here is my doctype, in case it makes a difference:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
This is my first post, and I'm afraid it's gonna be a long one. A while back I discovered the navigation matrix technique in a book called The Art & Science of CSS. The same sort of thing is described here: http://superfluousbanter.org/archives/2004/05/navigation-matrix/, although it's not the exact same example they used in the book.
I have used it successfully for horizontal menus several times. Now I am trying to create a vertical menu using the same technique, and it's not working. I'm hoping that someone here might be able to point out what I'm missing, or, if it's impossible to do maybe someone can explain why. If I can make this work it will come in handy a lot, especially when working with graphic designers who love fancy fonts...
First I'll paste in the code & image from the horizontal version, which is working fine:
XHTML
<ul id="navlist">
<li id="hm"><a href="#" id="urhere">HOME</a></li>
<li id="abt"><a href="about.html">ABOUT</a></li>
<li id="wrk"><a href="work.html">WORK</a></li>
<li id="cntct"><a href="contact.html">CONTACT</a></li>
</ul>
CSS
/*For Main Navigation*/
#navlist {
width: 298px;
height: 31px;
position: relative;
background: url(../images/main_nav.jpg);
margin: 10px 0px 0px 0px;
padding:0;
list-style-type:none;
}
#navlist li {
float: left;
}
#navlist li a {
position: absolute;
top:0;
margin:0;
padding:0;
display: block;
height: 30px;
background: url(../images/main_nav.jpg) no-repeat;
text-indent: -9999px;
overflow: hidden;
font-size: 1%;
}
li#hm a {
left: 0px;
width: 70px;
background-position: 0px 0px;
}
li#abt a {
left: 70px;
width: 70px;
background-position: -70px 0px;
}
li#wrk a {
left: 140px;
width: 70px;
background-position: -140px 0px;
}
li#cntct a {
left: 210px;
width: 88px;
background-position: -210px 0px;
}
li#hm a:hover {
background-position: 0px -31px;
}
li#abt a:hover {
background-position: -70px -31px;
}
li#wrk a:hover {
background-position: -140px -31px;
}
li#cntct a:hover {
background-position: -210px -31px;
}
#hm #urhere {
background-position: 0px -62px;
}
#abt #urhere {
background-position: -70px -62px;
}
#wrk #urhere {
background-position: -140px -62px;
}
#cntct #urhere {
background-position: -210px -62px;
}
IMAGE (298px wide by 93px high)
http://www.lauriesterlingjensen.com/test/phylliswongdesign2/images/main_nav.jpg
And here is the code and image for the vertical version, which is not working:
XHTML
<ul id="subnavlist">
<li id="prnt"><a href="#" id="current">Print</a></li>
<li id="brnd"><a href="michigan.html">Brand</a></li>
<li id="msc"><a href="solar.html">Miscellany</a></li>
</ul>
CSS
/*For Secondary Navigation*/
#subnavlist {
position:relative;
width:91px;
height:90px;
margin:0;
padding:0;
background: url(../images/sub_nav.jpg);
list-style-type:none;
}
#subnavlist li {
float:left
}
#subnavlist li a {
position:absolute;
top:0;
margin:0;
padding:0;
display:block;
height: 30px;
width: 91px;
background: url(../images/sub_nav.jpg) no-repeat;
text-indent: -9999px;
overflow: hidden;
font-size: 1%;
background-attachment:fixed;
}
li#prnt a {
left:0;
width:91px;
background-position:0px;
}
li#brnd a {
left:0;
width:91px;
background-position:0px;
}
li#msc a {
left:0;
width:91px;
background-position:0px;
}
li#prnt a:hover {
background-position:-91px 0;
}
li#brnd a:hover {
background-position:-91px 0;
}
li#msc a:hover {
background-position:-91px 0;
}
#prnt #current {
background-position: -182px 0;
}
#brnd #current {
background-position: -182px 0;
}
#msc #current {
background-position: -182px 0;
}
IMAGE (273px wide by 90px high)
http://www.lauriesterlingjensen.com/test/phylliswongdesign2/images/sub_nav.jpg
Thanks for reading!
P.S. Here is my doctype, in case it makes a difference:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">