Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML&;CSS问题:如何通过将鼠标悬停在图像上来增加图像的高度?_Html_Css_Facebook_Image - Fatal编程技术网

HTML&;CSS问题:如何通过将鼠标悬停在图像上来增加图像的高度?

HTML&;CSS问题:如何通过将鼠标悬停在图像上来增加图像的高度?,html,css,facebook,image,Html,Css,Facebook,Image,假设,我有一个facebook徽标图像。这张图片还可以作为我的facebook个人资料的链接。现在,我想只要用户把鼠标光标放在它上面,它就应该增加高度(比如说3px) 这是我正在编写的源代码: .HTML: <div id="find_me_on"> <p>Find me on:</p><br><a href="https://www.facebook.com/unknownuser"><img

假设,我有一个facebook徽标图像。这张图片还可以作为我的facebook个人资料的链接。现在,我想只要用户把鼠标光标放在它上面,它就应该增加高度(比如说3px)

这是我正在编写的源代码:

   .HTML:

     <div id="find_me_on">

        <p>Find me on:</p><br><a href="https://www.facebook.com/unknownuser"><img src="img/fblogo.png" title="Facebook" id="inc_fb_height" /></a>
        </div


    .CSS:

  #inc_fb_height{
    /*Need help*/
    }
.HTML:
在以下网站上找到我:



我为此制作了一把JS小提琴。-


我为此制作了一把JS小提琴。-

使用你所拥有的:

#inc_fb_height{
height:100px; 
}
但是再加上

#inc_fb_height:hover{
height:103px; 
}
在鼠标悬停时创建一个悬停属性,将原始悬停属性更改为3倍高,使用您现有的:

#inc_fb_height{
height:100px; 
}
但是再加上

#inc_fb_height:hover{
height:103px; 
}

创建一个悬停属性,在鼠标悬停时将原始图像更改为3倍高,将悬停状态添加到图像中:

HTML:

小提琴:
将悬停状态添加到图像:

HTML:

小提琴:

如果您只需要css修复,请使用此小提琴

如果可以使用javascript,请使用此提琴

jquery

 $(document).ready(function(){
    $('.img-zoom').hover(function() {
        $(this).addClass('transition');

    }, function() {
        $(this).removeClass('transition');
    });
  });

如果您只需要css修复,请使用此小提琴

如果可以使用javascript,请使用此提琴

jquery

 $(document).ready(function(){
    $('.img-zoom').hover(function() {
        $(this).addClass('transition');

    }, function() {
        $(this).removeClass('transition');
    });
  });
不要浪费JavaScript(尤其是jQuery),因为这些东西只需要CSS:

#inc_fb_height {
    -webkit-transition: all .2s ease-out;
    -moz-transition: all .2s ease-out;
    -ms-transition: all .2s ease-out;
    -o-transition: all .2s ease-out;
    transition: all .2s ease-out;
}

#inc_fb_height:hover {
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
    transform: scale(1.1);
}
当然,您也可以使用
scale(1,1.1)
scaleY(1.1)
缩放高度

尽管最好从比例因子开始不要浪费JavaScript(尤其是jQuery),但您只需要CSS:

#inc_fb_height {
    -webkit-transition: all .2s ease-out;
    -moz-transition: all .2s ease-out;
    -ms-transition: all .2s ease-out;
    -o-transition: all .2s ease-out;
    transition: all .2s ease-out;
}

#inc_fb_height:hover {
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
    transform: scale(1.1);
}
当然,您也可以使用
scale(1,1.1)
scaleY(1.1)
缩放高度


不过,最好从比例因子开始,您确定要增加高度吗?可以按比例缩放。是否确实要增加高度?你可以按比例扩展它。这是一个非常聪明的解决方案,它帮助了我。虽然我只是想提高身高,为什么不接受你这样好的建议呢?对不起,再次打断你!您的TRIC仅在我的本地主机中工作。但是在我的网站上,在公共服务器上,这些转换/缩放属性不起作用。他们只是在盘旋中无所事事。如果你有时间的话,请在我的网站的最底部查看:你在用什么浏览器?在IE11和最新的chrome和firefox中,它对我来说很好用。你试过删除你的浏览器缓存吗?好的,很高兴我能帮忙:)-顺便说一句,在大多数动画中,“放松”通常比“放松”看起来更好。这是一个非常聪明的解决方案,它帮助了我。虽然我只是想提高身高,为什么不接受你这样好的建议呢?对不起,再次打断你!您的TRIC仅在我的本地主机中工作。但是在我的网站上,在公共服务器上,这些转换/缩放属性不起作用。他们只是在盘旋中无所事事。如果你有时间的话,请在我的网站的最底部查看:你在用什么浏览器?在IE11和最新的chrome和firefox中,它对我来说很好用。你试过删除你的浏览器缓存吗?好的,很高兴我能帮忙:)-顺便说一句,在大多数动画中,“放松”通常比“放松”看起来更好。我会在我的回答中改变它。
#inc_fb_height {
    -webkit-transition: all .2s ease-out;
    -moz-transition: all .2s ease-out;
    -ms-transition: all .2s ease-out;
    -o-transition: all .2s ease-out;
    transition: all .2s ease-out;
}

#inc_fb_height:hover {
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
    transform: scale(1.1);
}
#inc_fb_height {
    -webkit-transition: all .2s ease-out;
    -moz-transition: all .2s ease-out;
    -ms-transition: all .2s ease-out;
    -o-transition: all .2s ease-out;
    transition: all .2s ease-out;
    -webkit-transform: scale3d(0.9, 0.9, 1);
    -moz-transform: scale3d(0.9, 0.9, 1);
    -ms-transform: scale3d(0.9, 0.9, 1);
    -o-transform: scale3d(0.9, 0.9, 1);
    transform: scale3d(0.9, 0.9, 1);
}

#inc_fb_height:hover {
    -webkit-transform: scale3d(1, 1, 1);
    -moz-transform: scale3d(1, 1, 1);
    -ms-transform: scale3d(1, 1, 1);
    -o-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
}