/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Horizontal list with rollovers…

Hi all,
Horizontal list problem:

Cannot get a horizontal list to rollover – it just works in a tiny area where the &nbsp is.

HTML:

[CODE]
<ul id=”navlist” >
<li id=”nav_home” title=”return home”>
<a href=”index.php”>&nbsp;
</a>
</li>
<li id=”nav_radio” title=”go to radio”>
<a href=”http://www.radi1.com”>&nbsp;
</a>
</li>
<li id=”nav_web” title=”visit itv”>
<a href=”http://www.itv.com” title=”blog”>&nbsp;
</a>
</li>
</ul>[/CODE]

CSS:

[code=html]
@charset “utf-8”;
/* CSS Document */

ul#navlist {
margin-left: 0;
padding-left: 0;
white-space: nowrap;

}
#navlist li {
display: inline-block;
list-style-type: none;
height:56.7px;
float:left;
}
#navlist li, #navlist a {
text-decoration: none;
height:56.7px;
}
#navlist a:hover {
text-decoration: none;
}
#nav_home{
display:block;
width:170px;
height:56.7px;
background:url(../imgs/nav/home.png) 0px 0px no-repeat;

}
#nav_home a:hover{
height:56.7px;
width:170px;
background: url(../imgs/nav/home.png) 0 -56.7px;
display:block;
}

#nav_radio {
width:180px;
height:56.7px;
background:url(../imgs/nav/radio.png) 0px 0px no-repeat;
display:block;
}
#nav_radio a:hover{
height:56.7px;
width:180px;
background: url(../imgs/nav/radio.png) 0px -56.7px;
display:block;
}
#nav_web{
width:145px;
height:56.7px;
background:url(../imgs/nav/blog.png) 0px 0px no-repeat;
}
#nav_web a:hover{
height:56.7px;
width:145px;
background: url(../imgs/nav/blog.png) 0px -56.7px;
display:block;
}
[/code]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@DasherMay 10.2011 — [CODE]<ul id="navlist" >
<li id="nav_home" title="return home">
<a href="index.php">Return Home
</a>
</li>
<li id="nav_radio" title="go to radio">
<a href="http://www.radi1.com">Go to Radio
</a>
</li>
<li id="nav_web" title="visit itv">
<a href="http://www.itv.com" title="blog">Visit ITV
</a>
</li>
</ul>[/CODE]
Copy linkTweet thisAlerts:
@AliHurworthauthorMay 11.2011 — (Thanks Dasher)

Okay what worked is as follows.

There might be more CSS than you need, especially the height declarations. The main things are that the li's are displayed as block, and the a's are displayed inline.

HTML:
[code=html]
<ul id="navlist" >
<li id="nav_home" title="return home">
<a href="index.php">
</a>
</li>
<li id="nav_radio" title="go to radio">
<a href="radio.php">
</a>
</li>
<li id="nav_web" title="visit the blog">
<a href="blog.php" title="blog">
</a>
</li>
</ul>[/code]


...CSS...
[code=html]
@charset "utf-8";
/* CSS Document */

ul#navlist
{
margin-left: 0;
padding-left: 0;
white-space: nowrap;
}

#navlist li
{
display: inline;
list-style-type: none;
height:56.7px;
float:left;
}

#navlist a {display:block }

#navlist a:link, #navlist a:visited
{
color: #fff;
background-color: #036;
text-decoration: none;
}

#navlist a:hover
{
color: #fff;
background-color: #369;
text-decoration: none;
}
#nav_home a{
width:170px;
height:56.7px;
background:url(../imgs/nav/home.png) 0px 0px no-repeat;
}
#nav_home a:hover{
height:56.7px;
width:170px;
background: url(../imgs/nav/home.png) 0 -56.7px;
}
#nav_radio a{
width:180px;
height:56.7px;
background:url(../imgs/nav/radio.png) 0px 0px no-repeat;
}
#nav_radio a:hover{
height:56.7px;
width:180px;
background:url(../imgs/nav/radio.png) 0px -56.7px;
}
#nav_web a{
width:145px;
height:56.7px;
background:url(../imgs/nav/blog.png) 0px 0px no-repeat;
}
#nav_web a:hover{
height:56.7px;
width:145px;
background:url(../imgs/nav/blog.png) 0px -56.7px;
}
[/code]
×

Success!

Help @AliHurworth spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...