CSS Transition font-size: avoid jittering / wiggling
On hover put transition: border-color 0s, font-size 0.3s ease-out;
Because on hover transition: border-color 0s
will give only border-color
transition not give to font-size
.
body {
font-family: 'Segoe UI', sans-serif;
}
.website {
width: 180px;
height: 73px;
text-align: center;
line-height: 80px;
margin: 1px;
color: white;
border-bottom: 5px solid darkslateblue;
background-color: darkslateblue;
white-space: nowrap;
overflow: hidden;
transition: border-color 0.66s ease-out, font-size 0.3s ease-out;
}
.website:hover {
font-size: 16pt;
cursor: pointer;
transition: border-color 0s, font-size 0.3s ease-out;
border-color: black;
}
<div class="website">Blog 1</div>
<div class="website">Blog 2</div>
<div class="website">Blog 3</div>
You can use CSS transform:scale
instead for a smoother transition like so:
.website:hover {
cursor: pointer;
transition: border-color 0.4s;
border-color: black;
}
.website div {
transition: transform 0.3s ease-out;
}
.website:hover div {
transform: scale(1.5);
transition: transform 0s;
}
Here is the JSFiddle demo
Also note that I added the texts within a div
and the scaling was done on the div
so that the whole box is not scaled :)