Forum Moderators: not2easy
.nav ul li a {
font-size:16px;
text-decoration:none;
padding:25px 19px;
width:auto;
float:left;
text-align:center;
border-left:1px solid #363636;
margin:10px 0;
}
.nav ul li a:hover, .nav ul li a.pageFlag{
background: url("images/curli.png") no-repeat ;
background-position: center;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.nav {
margin:0;
padding:0;
list-style:none;
}
.nav li {
float:left;
border-left:1px solid #363636;
margin:20px 0;
}
.nav li a {
font-size:16px;
text-decoration:none;
padding:25px 19px;
float:left;
margin:-10px 0;
position:relative;
text-align:center;
}
.nav li a:hover, .nav li a.pageFlag {
background:red url("images/curli.png") no-repeat 50% 50%;
}
</style>
</head>
<body>
<ul class="nav">
<li><a href="#">test</a></li>
<li><a class="pageFlag"href="#">test</a></li>
<li><a href="#">test</a></li>
<li><a href="#">test</a></li>
<li><a href="#">test</a></li>
</ul>
</body>
</html>
.nav li a means the <li> dimensions to <a>'s border edge. That reproduces the undesired taller border, so I'm wondering if that was an accidental cut/paste from the original code and should be deleted?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.nav {
margin:0;
padding:0;
list-style:none;
}
.nav li {
float:left;
margin:20px 0;
border-left:1px solid #363636;
line-height:1.0;
}
.nav li a {
font-size:16px;
text-decoration:none;
padding:15px 19px;
margin:-15px 0;
float:left;
position:relative;
text-align:center;
}
.nav li a:hover, .nav li a.pageFlag {
background:red url("images/curli.png") no-repeat 50% 50%;
}
</style>
</head>
<body>
<ul class="nav">
<li><a href="#">test</a></li>
<li><a class="pageFlag"href="#">test</a></li>
<li><a href="#">test</a></li>
<li><a href="#">test</a></li>
<li><a href="#">test</a></li>
</ul>
</body>
</html>
As usual with CSS there's probably loads of other ways to do the same things. I think that's the beauty of CSSExactly - which is why I believe the thoughts behind a possible solution are just as, if not more interesting than the code itself. Thanks for yet another careful explanation Paul.