/    Sign up×
Community /Pin to ProfileBookmark

Scale hover effect fixed

On my portfolio I have a hover effect on some cards, the problem is that if you hover just on the edge there is a weird effect where it changes scales very fast.
Is there a fix for that?

https://rogojanraulportfolio.netlify.app/

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@cootheadOct 03.2021 — Hi there RaulRogojan

>...the problem is that if you hover just on the edge there

>is a weird effect where it changes scales very fast.

> Is there a fix for that?


If the edge of the cards are hovered, their dimensions diminish,

so that the hover state ceases. Their dimensions will therefore

simply return to their original state.

The only fix, that I can think of, would be to reverse the effect.

In other words go from small to larger rather than from large

to smaller.

Also note that [b]div elements[/b] are not required in the [b]a elements[/b].

Just use this HTML code...

<div class="projects">
<div class="projects-grid">
<a href="summitTechProject.html" class="project-card project-1"></a>
<a href="burgerRestaurantProject.html" class="project-card project-2"></a>
<a href="carousel.html" class="project-card project-3"></a>
<a href="toDoApp.html" class="project-card project-4"></a>
</div>
</div>


...and this CSS...

.project-card:hover {
transform: scale(1.05);
border: 3px solid var(--main-color);
}


[i]coothead[/i]
Copy linkTweet thisAlerts:
@codyhillauthorOct 04.2021 — @coothead#1637810 Thank you very much!

The fix I found was to add the hover effect on the a element while hovering on the div.


.project-card:hover &gt; a {<br/>
transform: scale(0.95);<br/>
border: 3px solid var(--main-color);<br/>
}

``<i>
</i>Also using this HTML
&lt;div class="project-card project-1"&gt;
&lt;a href="summitTechProject.html"&gt;
&lt;/div&gt;<i>
</i>
``
Copy linkTweet thisAlerts:
@codyhillauthorOct 04.2021 — @coothead#1637810 Here is a DEMO if anyone wanna see it.

https://codepen.io/raul-rogojan/pen/XWgwexW?editors=1100

It does look a bit weird if you keep the border.
×

Success!

Help @codyhill 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.13,
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,
)...