/    Sign up×
Community /Pin to ProfileBookmark

CSS Rollover Padding

I’m fairly new to css, but am trying to impliment a roll over on my navbar div

My CSS is :

[CODE]#navi a:hover {
font-family: Arial, Verdana, Georgia, “Arial Rounded MT Bold”;
font-size: 14px;
font-weight: normal;
color: #0C1A55;
background-color: #FFFFFF;
display: inline;
text-align: center;
text-decoration: none;
padding-top: 8px;
padding-right: 4px;
padding-bottom: 8px;
padding-left: 4px;
}
#navi a:link {
color: #FFFFFF;
font-family: Arial, Verdana, Georgia, “Arial Rounded MT Bold”;
font-size: 14px;
}
#navi a:active {
color: #FFFFFF;
font-family: Arial, Verdana, Georgia, “Arial Rounded MT Bold”;
font-size: 14px;

}
#navi a:visited {
color: #FFFFFF;
font-family: Arial, Verdana, Georgia, “Arial Rounded MT Bold”;
font-size: 14px;
}
[/CODE]

and my HTML is:

[CODE]<div id=”navi”><a>Corporate Events</a> <a>The Fleet</a> <a> Corporate Hospitality</a><a> Team Building</a><a> Incentives &amp; Rewards</a> <a>Locations</a></div>[/CODE]

The rollover works fine but it moves the rest of the text in the DIV when i rollover one of the headings. How do i keep it so the rest of the links remain still?

Please forgive me if i’m missing something really obvious.

Thanks
J

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@ohausurferauthorMay 29.2008 — oh and my navi is in the main style sheet

[CODE]#navi {
position: absolute;
top: 116px;
height: 25px;
width: 900px;
color: #FFFFFF;
font-family: Arial, Verdana, Georgia, "Arial Rounded MT Bold";
z-index: 1;
text-align: center;
left: 2px;
font-size: 14px;
word-spacing: 0.3em;
}
[/CODE]
Copy linkTweet thisAlerts:
@CentauriMay 29.2008 — Set everything in the <a> first, then only define what you want [I][B]changed[/B][/I] on the hover :[CODE]#navi a {
font-family: Arial, Verdana, Georgia, "Arial Rounded MT Bold";
font-size: 14px;
font-weight: normal;
color: #FFFFFF;
display: inline;
text-align: center;
text-decoration: none;
padding-top: 8px;
padding-right: 4px;
padding-bottom: 8px;
padding-left: 4px;
}
#navi a:hover {
color: #0C1A55;
background-color: #FFFFFF;
}
[/CODE]
Copy linkTweet thisAlerts:
@ohausurferauthorMay 29.2008 — ah great stuff.

Thanks so much
Copy linkTweet thisAlerts:
@ohausurferauthorMay 29.2008 — The rollover is working but its just applying it to the text and the padding isnt working in IE.

Working great in FF.

Thanks

J
Copy linkTweet thisAlerts:
@interpoleraterMay 29.2008 — IE 6 and lower only supports :hover when used on <a> tags.
Copy linkTweet thisAlerts:
@ohausurferauthorMay 29.2008 — I'm running IE7 and the hover is working, its just not applying the padding
Copy linkTweet thisAlerts:
@CentauriMay 29.2008 — [CODE]#navi a {
font-family: Arial, Verdana, Georgia, "Arial Rounded MT Bold";
font-size: 14px;
font-weight: normal;
color: #FFFFFF;
display: inline;
text-align: center;
text-decoration: none;
padding-top: 8px;
padding-right: 4px;
padding-bottom: 8px;
padding-left: 4px;
[COLOR="Red"]position: relative;[/COLOR]
}[/CODE]
×

Success!

Help @ohausurfer 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.3,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...