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!










share|improve this question







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.
























    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!










    share|improve this question







    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.






















      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!










      share|improve this question







      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






      share|improve this question







      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.











      share|improve this question







      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.









      share|improve this question




      share|improve this question






      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.
























          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.






          share|improve this answer





















          • 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




















          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






          share|improve this answer





















          • You're all the best, thanks!
            – Wouter S
            Nov 10 at 17:39


















          up vote
          0
          down vote













          remove



             a:hover
          {
          float: right;
          }


          and insert



            #div2:hover
          {
          float: right;
          }





          share|improve this answer





















          • Thanks you! It worked, i'll keep this one in mind.
            – Wouter S
            Nov 10 at 17:39











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


          }
          });






          Wouter S is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          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

























          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.






          share|improve this answer





















          • 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

















          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.






          share|improve this answer





















          • 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















          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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




















          • 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














          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






          share|improve this answer





















          • You're all the best, thanks!
            – Wouter S
            Nov 10 at 17:39















          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






          share|improve this answer





















          • You're all the best, thanks!
            – Wouter S
            Nov 10 at 17:39













          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






          share|improve this answer












          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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 17:35









          Snake14

          22217




          22217












          • 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




          You're all the best, thanks!
          – Wouter S
          Nov 10 at 17:39










          up vote
          0
          down vote













          remove



             a:hover
          {
          float: right;
          }


          and insert



            #div2:hover
          {
          float: right;
          }





          share|improve this answer





















          • Thanks you! It worked, i'll keep this one in mind.
            – Wouter S
            Nov 10 at 17:39















          up vote
          0
          down vote













          remove



             a:hover
          {
          float: right;
          }


          and insert



            #div2:hover
          {
          float: right;
          }





          share|improve this answer





















          • Thanks you! It worked, i'll keep this one in mind.
            – Wouter S
            Nov 10 at 17:39













          up vote
          0
          down vote










          up vote
          0
          down vote









          remove



             a:hover
          {
          float: right;
          }


          and insert



            #div2:hover
          {
          float: right;
          }





          share|improve this answer












          remove



             a:hover
          {
          float: right;
          }


          and insert



            #div2:hover
          {
          float: right;
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          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


















          • 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










          Wouter S is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          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.















           


          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          List item for chat from Array inside array React Native

          Thiostrepton

          Caerphilly