CSS hover, transition effect in the same direction











up vote
-1
down vote

favorite












I am doing some basic CSS fill transitions on hover. I have used this codepen as an example: https://codepen.io/brandon4117/pen/ihIgE. Now on hover the background position raises to fill the div, and on hover off, the background goes back down. I wanted to know how can I modify this pen, to work such as when hover off the transition should go upwards, rather than down.



Most hover transitions: Hover on new fill top->bottom. Hover off new fill removes bottom->top. I would like to do on hover fill top->bottom, on hover off fill removes top->bottom again.



A look at the CSS being used:



div {border-style: solid;
border-color: black;
color: black;
padding: 50px;
background-size: 200% 200%;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position:0 100%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;

}

div:hover {color: white;
border-color: #A72424;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position: 0 0%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
}

a {color: black; text-decoration: none;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;}

a:hover {color: white;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;
}

a:active {color: white;}


Thanks










share|improve this question
























  • Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
    – tera_789
    2 days ago










  • Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
    – balaji sreenivas
    2 days ago










  • transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
    – LGSon
    2 days ago










  • There might be some options using a couple of extra child elements, or the pseudo elements.
    – LGSon
    2 days ago










  • Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
    – tera_789
    2 days ago















up vote
-1
down vote

favorite












I am doing some basic CSS fill transitions on hover. I have used this codepen as an example: https://codepen.io/brandon4117/pen/ihIgE. Now on hover the background position raises to fill the div, and on hover off, the background goes back down. I wanted to know how can I modify this pen, to work such as when hover off the transition should go upwards, rather than down.



Most hover transitions: Hover on new fill top->bottom. Hover off new fill removes bottom->top. I would like to do on hover fill top->bottom, on hover off fill removes top->bottom again.



A look at the CSS being used:



div {border-style: solid;
border-color: black;
color: black;
padding: 50px;
background-size: 200% 200%;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position:0 100%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;

}

div:hover {color: white;
border-color: #A72424;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position: 0 0%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
}

a {color: black; text-decoration: none;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;}

a:hover {color: white;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;
}

a:active {color: white;}


Thanks










share|improve this question
























  • Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
    – tera_789
    2 days ago










  • Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
    – balaji sreenivas
    2 days ago










  • transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
    – LGSon
    2 days ago










  • There might be some options using a couple of extra child elements, or the pseudo elements.
    – LGSon
    2 days ago










  • Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
    – tera_789
    2 days ago













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I am doing some basic CSS fill transitions on hover. I have used this codepen as an example: https://codepen.io/brandon4117/pen/ihIgE. Now on hover the background position raises to fill the div, and on hover off, the background goes back down. I wanted to know how can I modify this pen, to work such as when hover off the transition should go upwards, rather than down.



Most hover transitions: Hover on new fill top->bottom. Hover off new fill removes bottom->top. I would like to do on hover fill top->bottom, on hover off fill removes top->bottom again.



A look at the CSS being used:



div {border-style: solid;
border-color: black;
color: black;
padding: 50px;
background-size: 200% 200%;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position:0 100%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;

}

div:hover {color: white;
border-color: #A72424;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position: 0 0%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
}

a {color: black; text-decoration: none;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;}

a:hover {color: white;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;
}

a:active {color: white;}


Thanks










share|improve this question















I am doing some basic CSS fill transitions on hover. I have used this codepen as an example: https://codepen.io/brandon4117/pen/ihIgE. Now on hover the background position raises to fill the div, and on hover off, the background goes back down. I wanted to know how can I modify this pen, to work such as when hover off the transition should go upwards, rather than down.



Most hover transitions: Hover on new fill top->bottom. Hover off new fill removes bottom->top. I would like to do on hover fill top->bottom, on hover off fill removes top->bottom again.



A look at the CSS being used:



div {border-style: solid;
border-color: black;
color: black;
padding: 50px;
background-size: 200% 200%;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position:0 100%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;

}

div:hover {color: white;
border-color: #A72424;
background-image:
linear-gradient(to top, #A72424 50%, transparent 50%);
background-position: 0 0%;
-webkit-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-moz-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-ms-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
-o-transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
transition: background-position 300ms, color 300ms ease, border-color 300ms ease;
}

a {color: black; text-decoration: none;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;}

a:hover {color: white;
transition: all 100ms linear;
-webkit-transition: all 100ms linear;
-moz-transition: all 100ms linear;
-ms-transition: all 100ms linear;
-o-transition: all 100ms linear;
}

a:active {color: white;}


Thanks







html css html5 css-transitions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked 2 days ago









balaji sreenivas

12




12












  • Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
    – tera_789
    2 days ago










  • Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
    – balaji sreenivas
    2 days ago










  • transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
    – LGSon
    2 days ago










  • There might be some options using a couple of extra child elements, or the pseudo elements.
    – LGSon
    2 days ago










  • Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
    – tera_789
    2 days ago


















  • Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
    – tera_789
    2 days ago










  • Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
    – balaji sreenivas
    2 days ago










  • transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
    – LGSon
    2 days ago










  • There might be some options using a couple of extra child elements, or the pseudo elements.
    – LGSon
    2 days ago










  • Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
    – tera_789
    2 days ago
















Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
– tera_789
2 days ago




Play with linear-gradient first of all...You should try something yourself first - this is how SO works. You show what you did, and people help you improve your work. Good luck
– tera_789
2 days ago












Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
– balaji sreenivas
2 days ago




Thanks for your response, my question is that there are two states: 1) On hover where I have some background-position and the original background-position which is what our control will default to on hover off. How can I get the transition in the same direction as the fill on hover?
– balaji sreenivas
2 days ago












transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
– LGSon
2 days ago




transition doesn't have a reverse value, like animation has, so to accomplish such transition effect you either need to combine it with a script, or use animation
– LGSon
2 days ago












There might be some options using a couple of extra child elements, or the pseudo elements.
– LGSon
2 days ago




There might be some options using a couple of extra child elements, or the pseudo elements.
– LGSon
2 days ago












Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
– tera_789
2 days ago




Also take a look at this: w3schools.com/w3css/w3css_animate.asp They have some pretty cool stuff, which is very easy to implement. It might not be exactly what you are looking for, but still...
– tera_789
2 days ago












2 Answers
2






active

oldest

votes

















up vote
0
down vote













i think it's easier to make this effect with a :before or a :after pseudo element instead of using the background if you're not using self closing tags.



div { padding: 50px; border: 2px solid #000; color: #000; position: relative; transition: 0.3s ease; }
div:after { content: ""; height: 0; width: 100%; background-color: #A72424; position: absolute; top: 0; left: 0; transition: 0.3s ease; }
div:hover { color: #fff; border-color: #A72424; }
div:hover:after { height: 100%; }


in case you need to use the linear gradient you just need to change the linear-gradient direction into "to bottom" instead of "to top"



div { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }
div:hover { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }





share|improve this answer








New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
    – balaji sreenivas
    2 days ago




















up vote
-1
down vote













Ok I got the answer: For top down do this:



.divclass::after {
position: absolute;
transition: 0.3s;
content: '';
height: 0;
top: 50%;
right: 0;
width: 3px;
background: #fff;
bottom: 0;
top: auto;
z-index: -1;
width: 120%;
}



.divclass:hover::after {
height: 100%;
top: 0;
}


Thanks for pointing me in the direction of pseudos Frderico






share|improve this answer





















  • Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
    – LGSon
    2 days ago













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',
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
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184037%2fcss-hover-transition-effect-in-the-same-direction%23new-answer', 'question_page');
}
);

Post as a guest
































2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













i think it's easier to make this effect with a :before or a :after pseudo element instead of using the background if you're not using self closing tags.



div { padding: 50px; border: 2px solid #000; color: #000; position: relative; transition: 0.3s ease; }
div:after { content: ""; height: 0; width: 100%; background-color: #A72424; position: absolute; top: 0; left: 0; transition: 0.3s ease; }
div:hover { color: #fff; border-color: #A72424; }
div:hover:after { height: 100%; }


in case you need to use the linear gradient you just need to change the linear-gradient direction into "to bottom" instead of "to top"



div { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }
div:hover { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }





share|improve this answer








New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
    – balaji sreenivas
    2 days ago

















up vote
0
down vote













i think it's easier to make this effect with a :before or a :after pseudo element instead of using the background if you're not using self closing tags.



div { padding: 50px; border: 2px solid #000; color: #000; position: relative; transition: 0.3s ease; }
div:after { content: ""; height: 0; width: 100%; background-color: #A72424; position: absolute; top: 0; left: 0; transition: 0.3s ease; }
div:hover { color: #fff; border-color: #A72424; }
div:hover:after { height: 100%; }


in case you need to use the linear gradient you just need to change the linear-gradient direction into "to bottom" instead of "to top"



div { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }
div:hover { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }





share|improve this answer








New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
    – balaji sreenivas
    2 days ago















up vote
0
down vote










up vote
0
down vote









i think it's easier to make this effect with a :before or a :after pseudo element instead of using the background if you're not using self closing tags.



div { padding: 50px; border: 2px solid #000; color: #000; position: relative; transition: 0.3s ease; }
div:after { content: ""; height: 0; width: 100%; background-color: #A72424; position: absolute; top: 0; left: 0; transition: 0.3s ease; }
div:hover { color: #fff; border-color: #A72424; }
div:hover:after { height: 100%; }


in case you need to use the linear gradient you just need to change the linear-gradient direction into "to bottom" instead of "to top"



div { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }
div:hover { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }





share|improve this answer








New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









i think it's easier to make this effect with a :before or a :after pseudo element instead of using the background if you're not using self closing tags.



div { padding: 50px; border: 2px solid #000; color: #000; position: relative; transition: 0.3s ease; }
div:after { content: ""; height: 0; width: 100%; background-color: #A72424; position: absolute; top: 0; left: 0; transition: 0.3s ease; }
div:hover { color: #fff; border-color: #A72424; }
div:hover:after { height: 100%; }


in case you need to use the linear gradient you just need to change the linear-gradient direction into "to bottom" instead of "to top"



div { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }
div:hover { background-image: linear-gradient(to bottom, #A72424 50%, transparent 50%); }






share|improve this answer








New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered 2 days ago









Federico Pasquarelli

1




1




New contributor




Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Federico Pasquarelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
    – balaji sreenivas
    2 days ago




















  • Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
    – balaji sreenivas
    2 days ago


















Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
– balaji sreenivas
2 days ago






Thank you for responding to my query, Your code reverses the direction of the transition which is good, but what I am looking for is: Let's say my div has a background color white, on hover we are filling the div with a color black, direction of transition is top->bottom. Now when I remove the mouse from the element the white color will transition from bottom->top. I want this transition to be from top -> bottom. Hope I am clear.
– balaji sreenivas
2 days ago














up vote
-1
down vote













Ok I got the answer: For top down do this:



.divclass::after {
position: absolute;
transition: 0.3s;
content: '';
height: 0;
top: 50%;
right: 0;
width: 3px;
background: #fff;
bottom: 0;
top: auto;
z-index: -1;
width: 120%;
}



.divclass:hover::after {
height: 100%;
top: 0;
}


Thanks for pointing me in the direction of pseudos Frderico






share|improve this answer





















  • Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
    – LGSon
    2 days ago

















up vote
-1
down vote













Ok I got the answer: For top down do this:



.divclass::after {
position: absolute;
transition: 0.3s;
content: '';
height: 0;
top: 50%;
right: 0;
width: 3px;
background: #fff;
bottom: 0;
top: auto;
z-index: -1;
width: 120%;
}



.divclass:hover::after {
height: 100%;
top: 0;
}


Thanks for pointing me in the direction of pseudos Frderico






share|improve this answer





















  • Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
    – LGSon
    2 days ago















up vote
-1
down vote










up vote
-1
down vote









Ok I got the answer: For top down do this:



.divclass::after {
position: absolute;
transition: 0.3s;
content: '';
height: 0;
top: 50%;
right: 0;
width: 3px;
background: #fff;
bottom: 0;
top: auto;
z-index: -1;
width: 120%;
}



.divclass:hover::after {
height: 100%;
top: 0;
}


Thanks for pointing me in the direction of pseudos Frderico






share|improve this answer












Ok I got the answer: For top down do this:



.divclass::after {
position: absolute;
transition: 0.3s;
content: '';
height: 0;
top: 50%;
right: 0;
width: 3px;
background: #fff;
bottom: 0;
top: auto;
z-index: -1;
width: 120%;
}



.divclass:hover::after {
height: 100%;
top: 0;
}


Thanks for pointing me in the direction of pseudos Frderico







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









balaji sreenivas

12




12












  • Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
    – LGSon
    2 days ago




















  • Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
    – LGSon
    2 days ago


















Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
– LGSon
2 days ago






Provide a proper code sample both at the question and the answer, that explains and shows, with a working code snippet, it all works, as with the existing, it is difficult to see how it can.
– LGSon
2 days ago




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184037%2fcss-hover-transition-effect-in-the-same-direction%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

横浜市

Rostock

Europa