Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

How to fix Hover css effect tremble/shaking?

fwntly

New Coder
I'm experiencing a shaking effect when hovering over buttons-links on my website. When I hover over the buttons, they shake instead of smoothly transitioning. Here's the CSS code
CSS:
header .buttons{
    margin: 7px 20px;
    transition: 0.5s;
}

header .buttons:hover{
    transform: scale(1.1);
}

header .buttons a{
    color: #ffffff;
    text-decoration: none;
    font-size: 32px;
    position: relative;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #5e8c87;
    transition: 0.5s;
    padding: 7px 7px;
    border-style: solid;
    border-color: whitesmoke;
}

header .buttons a:hover {
    letter-spacing: 0.15em;
    background: var(--clr);
    border-color: var(--clr);
    box-shadow: 0 0 35px var(--clr);
}

the same happens when hovering the mouse over the logo, which is a link to the main page of the site:
CSS:
header .logo a{
    background-image: url("logo.png");
    background-size: 180px;
    background-repeat: no-repeat;
    position: relative;
    width:180px;
    height: 180px;
    display: inline-block;
    text-indent: -9999999px;
    border-radius: 50%;
    transition: 0.3s;
}

header .logo a:hover {
    transform: scale(1.05);
    letter-spacing: 0.15em;
    box-shadow: 0 0 15px var(--clr);
}
 
i could replicate the issue at https://codepen.io/rene-veerman/pen/NWJgrMv ; when i hover the mouse over the animated edge in certain x-pos zones, the animated div "gets confused" and starts flickering because the ".someClassName:hover" starts conflicting with ".someClassName".. don't quite have an answer as to how to solve this yet, but i'll give it a shot tonight..
Ah, thanks for sharing that! It ended up being that I did my buttons a bit differently which was why I wasn't able to replicate it. But after changing the buttons to the same style as yours I got the same thing.
 
I believe you can also fix this by adjusting the transform: scale(1.1) to transform: scale(1.0) under header .buttons:hover. I tried the change on my machine, and it fixed the issue; I also tested it in the codepen that @rene7705 shared, and it fixed the problem there.
 
Back
Top Bottom