Link animation scale to right
I have a link ("a" tag) in my css document, and I have an animation that scales a bottom border out from the center to both ends of the link. I want the animation to scale from the left side and stretch to the right
I have tried using a negative to positive translation on it, but that wasn't looking like I want it to. I can't seem to find any good articles on here, or any other website.
a:link:after
{
content: "";
display: block;
border-bottom: 2px solid white;
transform: scaleX(0);
transition: transform .2s ease-out;
}
a:hover:after
{
transform: scaleX(1);
}
The negative to positive translation doesn't hide the part of the border that hasn't been animated in yet, so there is just a random border to the left of the link.
css animation css-transforms
add a comment |
I have a link ("a" tag) in my css document, and I have an animation that scales a bottom border out from the center to both ends of the link. I want the animation to scale from the left side and stretch to the right
I have tried using a negative to positive translation on it, but that wasn't looking like I want it to. I can't seem to find any good articles on here, or any other website.
a:link:after
{
content: "";
display: block;
border-bottom: 2px solid white;
transform: scaleX(0);
transition: transform .2s ease-out;
}
a:hover:after
{
transform: scaleX(1);
}
The negative to positive translation doesn't hide the part of the border that hasn't been animated in yet, so there is just a random border to the left of the link.
css animation css-transforms
1
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
1
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37
add a comment |
I have a link ("a" tag) in my css document, and I have an animation that scales a bottom border out from the center to both ends of the link. I want the animation to scale from the left side and stretch to the right
I have tried using a negative to positive translation on it, but that wasn't looking like I want it to. I can't seem to find any good articles on here, or any other website.
a:link:after
{
content: "";
display: block;
border-bottom: 2px solid white;
transform: scaleX(0);
transition: transform .2s ease-out;
}
a:hover:after
{
transform: scaleX(1);
}
The negative to positive translation doesn't hide the part of the border that hasn't been animated in yet, so there is just a random border to the left of the link.
css animation css-transforms
I have a link ("a" tag) in my css document, and I have an animation that scales a bottom border out from the center to both ends of the link. I want the animation to scale from the left side and stretch to the right
I have tried using a negative to positive translation on it, but that wasn't looking like I want it to. I can't seem to find any good articles on here, or any other website.
a:link:after
{
content: "";
display: block;
border-bottom: 2px solid white;
transform: scaleX(0);
transition: transform .2s ease-out;
}
a:hover:after
{
transform: scaleX(1);
}
The negative to positive translation doesn't hide the part of the border that hasn't been animated in yet, so there is just a random border to the left of the link.
css animation css-transforms
css animation css-transforms
asked Dec 31 '18 at 3:16
stevesteve
658
658
1
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
1
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37
add a comment |
1
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
1
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37
1
1
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
1
1
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37
add a comment |
1 Answer
1
active
oldest
votes
You can use the translate property in combination with scale.
a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983256%2flink-animation-scale-to-right%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the translate property in combination with scale.
a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>add a comment |
You can use the translate property in combination with scale.
a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>add a comment |
You can use the translate property in combination with scale.
a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>You can use the translate property in combination with scale.
a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>a {
font-size: 24px;
text-decoration: none;
position: relative;
color: black;
overflow: hidden;
display: inline-block;
}
a:after {
content: "";
background: black;
height: 2px;
transform: translate3d(-100%, 0, 0) scale(0);
transition: transform .2s ease-out;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
a:hover:after {
transform: translate3d(0, 0, 0) scale(1);
}<a href="">LINK</a>answered Dec 31 '18 at 5:15
solsol
14.9k31832
14.9k31832
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983256%2flink-animation-scale-to-right%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can just use width for this.. 0 normal and on hover 100%
– Manjunath
Dec 31 '18 at 3:33
1
Btw you can just use height 2px with bg rather than using border with width.. it will work
– Manjunath
Dec 31 '18 at 3:34
That was exactly what I needed. Thanks!
– steve
Dec 31 '18 at 3:51
Glad it helped :)
– Manjunath
Dec 31 '18 at 11:37