Issue
I am using a css transition to fill my buttons during hover using box-shadow inset.
I am also using the transition to alter border-radius of the button during hover.
When I hover, the transition happens, but I am left with a thin unfilled curved line on each inner-corner of the button.
HTML
<div class="container">
<button type="button" id="upSwipe">Up Swipe</button>
<button type="button" id="downSwipe">Down Swipe</button>
<button type="button" id="leftSwipe">Left Swipe</button>
<button type="button" id="rightSwipe">Right Swipe</button>
</div>
CSS:
* {
margin: 0;
padding: 0;
background: none;
}
.container {
position: absolute;
background: black;
background-size: cover;
height: 100vh;
width: 100vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
button {
height: 200px;
width: 200px;
margin: 20px;
background: none;
border: 10px solid orange;
border-radius: 20px;
color: orange;
font-size: 30px;
box-shadow: inset 0 0 0 orange;
transition: 0.5s ease;
}
#upSwipe:hover {
box-shadow: inset 0 -7em 0 orange;
color: black;
border-radius: 30px;
}
* {
margin: 0;
padding: 0;
background: none;
}
.container {
position: absolute;
background: black;
background-size: cover;
height: 100vh;
width: 100vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
button {
height: 200px;
width: 200px;
margin: 20px;
background: none;
border: 10px solid orange;
border-radius: 20px;
color: orange;
font-size: 30px;
box-shadow: inset 0 0 0 orange;
transition: 0.5s ease;
}
#upSwipe:hover {
box-shadow: inset 0 -7em 0 orange;
color: black;
border-radius: 30px;
}
Solution
- You need to change the
border-radius
from button.- Remove the
border-radius
on hover.
removing border-radius
on hover alone will not fix the issue, you can either increase the border
size of button or decrease the border-radius
of the button.
* {
margin: 0;
padding: 0;
background: none;
}
.container {
position: absolute;
background: black;
background-size: cover;
height: 100vh;
width: 100vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
button {
height: 200px;
width: 200px;
margin: 20px;
background: none;
border: 10px solid orange;
border-radius: 10px;
color: orange;
font-size: 30px;
transition: 0.5s ease;
}
#upSwipe:hover {
box-shadow: inset 0 -7em 0 orange;
color: black;
}
#downSwipe:hover {
box-shadow: inset 0 7em 0 orange;
color: black;
}
#leftSwipe:hover {
box-shadow: inset 7em 0 0 orange;
color: black;
}
#rightSwipe:hover {
box-shadow: inset -7em 0 0 orange;
color: black;
}
<div class="container">
<button type="button" id="upSwipe">Up Swipe</button>
<button type="button" id="downSwipe">Down Swipe</button>
<button type="button" id="leftSwipe">Left Swipe</button>
<button type="button" id="rightSwipe">Right Swipe</button>
</div>
Answered By - Manjuboyz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.