Jump to content

Background hover on navigation "bumping" items

Go to solution Solved by Vicks,

Recommended Posts

Hey SS Forum friends,

I'm still pretty new to CSS, and am trying to add a hover effect to the navigation on this site, but what I've done adds a "bump" effect due to the padding I guess?

Any ideas on how to eliminate this? I tried adding the border and padding stuff, but to no avail... :S

 

/* Nav item color */
.header-nav-item a {
    border-radius: 10px 10px 0px 0px;
    padding: 2px 10px;
    transition-duration: 0.4s;
 
}
/* Nav item hover color */
.header-nav-item a:hover {
    background-color: #D5B56E !important;
  border-radius: 10px 10px 0px 0px;
  padding: 2px 10px;
    transition-duration: 0.4s;
}

 

Link to comment

Btw, in your :hover class, you just need to define the properties which you want to change, You can remove the border and padding from :hover class. 

However, the bump effect you mentioned might be caused by something else.

can you show it? a locked draft website should do.

Edited by Vicks
Link to comment
  • Solution

here is your CSS, you just needed to be more specific when targeting the item. Because of the specificity of CSS, there was another class taking over your padding settings. If you just change the selector, it should work:

/* Nav item color */
.header .header-nav-wrapper a {
    border-radius: 10px 10px 0px 0px;
    padding: 2px 10px;
    transition-duration: 0.4s;
 
}
/* Nav item hover color */
.header .header-nav-wrapper a:hover {
    background-color: #D5B56E !important;
  border-radius: 10px 10px 0px 0px;
  padding: 2px 10px;
    transition-duration: 0.4s;
}

 

Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.