How to make a DIV move when you hover over it
up vote
0
down vote
favorite
So i'm working on a school project (beginner to coding here), and i need to make a div move when you hover over it.
Here is my css code for that div:
#div2
{
box-shadow: 4px 4px 10px;
width: 80%;
height: 220px;
font-size: 15px;
margin-left: 5%;
margin-bottom: 3%;
text-align: center;
margin: auto;
background-color: #99CC00;
a:hover
{
float: right;
}
}
I need to make the whole box move to the right when you hover over it.
If anyone could help me that would be awesome!
html css
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
So i'm working on a school project (beginner to coding here), and i need to make a div move when you hover over it.
Here is my css code for that div:
#div2
{
box-shadow: 4px 4px 10px;
width: 80%;
height: 220px;
font-size: 15px;
margin-left: 5%;
margin-bottom: 3%;
text-align: center;
margin: auto;
background-color: #99CC00;
a:hover
{
float: right;
}
}
I need to make the whole box move to the right when you hover over it.
If anyone could help me that would be awesome!
html css
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So i'm working on a school project (beginner to coding here), and i need to make a div move when you hover over it.
Here is my css code for that div:
#div2
{
box-shadow: 4px 4px 10px;
width: 80%;
height: 220px;
font-size: 15px;
margin-left: 5%;
margin-bottom: 3%;
text-align: center;
margin: auto;
background-color: #99CC00;
a:hover
{
float: right;
}
}
I need to make the whole box move to the right when you hover over it.
If anyone could help me that would be awesome!
html css
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
So i'm working on a school project (beginner to coding here), and i need to make a div move when you hover over it.
Here is my css code for that div:
#div2
{
box-shadow: 4px 4px 10px;
width: 80%;
height: 220px;
font-size: 15px;
margin-left: 5%;
margin-bottom: 3%;
text-align: center;
margin: auto;
background-color: #99CC00;
a:hover
{
float: right;
}
}
I need to make the whole box move to the right when you hover over it.
If anyone could help me that would be awesome!
html css
html css
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 10 at 17:29
Wouter S
295
295
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Wouter S is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
1
down vote
accepted
If you are looking to move the whole div, you can make a new div id with a hover on it. Not just links have the ability to hover.
Example:
#div2:hover {
float: right;
}
Although, having a float on a hover will have it be very strange on the page. You can add padding-right to make it move just a little.
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
add a comment |
up vote
0
down vote
Your hover is currently just for a elements. If you want the div to do something, you'd have to add a new section with #div2: hover
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
remove
a:hover
{
float: right;
}
and insert
#div2:hover
{
float: right;
}
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
If you are looking to move the whole div, you can make a new div id with a hover on it. Not just links have the ability to hover.
Example:
#div2:hover {
float: right;
}
Although, having a float on a hover will have it be very strange on the page. You can add padding-right to make it move just a little.
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
add a comment |
up vote
1
down vote
accepted
If you are looking to move the whole div, you can make a new div id with a hover on it. Not just links have the ability to hover.
Example:
#div2:hover {
float: right;
}
Although, having a float on a hover will have it be very strange on the page. You can add padding-right to make it move just a little.
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
If you are looking to move the whole div, you can make a new div id with a hover on it. Not just links have the ability to hover.
Example:
#div2:hover {
float: right;
}
Although, having a float on a hover will have it be very strange on the page. You can add padding-right to make it move just a little.
If you are looking to move the whole div, you can make a new div id with a hover on it. Not just links have the ability to hover.
Example:
#div2:hover {
float: right;
}
Although, having a float on a hover will have it be very strange on the page. You can add padding-right to make it move just a little.
answered Nov 10 at 17:36
awtrimpe
363
363
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
add a comment |
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
Thanks!!! It worked!
– Wouter S
Nov 10 at 17:39
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
margin-right seems to have a nicer effect for me
– Matt Pengelly
Nov 10 at 17:47
add a comment |
up vote
0
down vote
Your hover is currently just for a elements. If you want the div to do something, you'd have to add a new section with #div2: hover
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
Your hover is currently just for a elements. If you want the div to do something, you'd have to add a new section with #div2: hover
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
up vote
0
down vote
Your hover is currently just for a elements. If you want the div to do something, you'd have to add a new section with #div2: hover
Your hover is currently just for a elements. If you want the div to do something, you'd have to add a new section with #div2: hover
answered Nov 10 at 17:35
Snake14
22217
22217
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
add a comment |
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
You're all the best, thanks!
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
remove
a:hover
{
float: right;
}
and insert
#div2:hover
{
float: right;
}
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
remove
a:hover
{
float: right;
}
and insert
#div2:hover
{
float: right;
}
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
add a comment |
up vote
0
down vote
up vote
0
down vote
remove
a:hover
{
float: right;
}
and insert
#div2:hover
{
float: right;
}
remove
a:hover
{
float: right;
}
and insert
#div2:hover
{
float: right;
}
answered Nov 10 at 17:35
Ali Naeimi
410512
410512
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
add a comment |
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
Thanks you! It worked, i'll keep this one in mind.
– Wouter S
Nov 10 at 17:39
add a comment |
Wouter S is a new contributor. Be nice, and check out our Code of Conduct.
Wouter S is a new contributor. Be nice, and check out our Code of Conduct.
Wouter S is a new contributor. Be nice, and check out our Code of Conduct.
Wouter S is a new contributor. Be nice, and check out our Code of Conduct.
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%2f53241582%2fhow-to-make-a-div-move-when-you-hover-over-it%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