[英]How to make button have a pop-up effect and border to have a white shadow when mouse hover above the button
Functionality: 功能:
The Button should have the following effect when user hover above the button: 当用户将鼠标悬停在按钮上方时,该按钮应具有以下效果:
What has been done: 已经做了什么:
I have made use of 我已经利用了
img:hover{
border-color: white;
}
to try to get the effect of the a border shadow of white. 尝试获得白色边框阴影的效果。
Issue: 问题:
I can't really seem to get the said effect. 我似乎无法真正获得上述效果。 However, I was able to get the effect such as this : 但是,我能够得到这样的效果:
img:hover{
background-color: white;
}
when user hover above the button. 当用户将鼠标悬停在按钮上方时。
Hence, how am I able to create the css such that when user hover above the button, it will create the said effect. 因此,我如何创建CSS,以便当用户将鼠标悬停在按钮上方时,它将创建上述效果。
Thanks. 谢谢。
img:hover { border-color: white; } #Button1 { position: absolute; top: 310px; left: 1550px; outline: 0px; z-index: 2; border: 0; background: transparent; }
<button id="Button1" onclick="GreatLoveInSingapore()"> <img src="lib/img/GreatLoveButton.png"> </button>
Here's a link that can help you. 这是一个可以帮助您的链接。
http://ianlunn.github.io/Hover/ http://ianlunn.github.io/Hover/
this page has a collection of over effects. 此页面有过度效果的集合。
If you want just to grow up your button you should use transfrom it allow you to scale your button 如果您只想长大按钮,则应使用transfrom来缩放按钮
div{ margin: 50px 200px; } button{ border: 0; padding: 0; cursor: pointer } img { height: 100px; width: 100px; display: block; transition: 0.7s; } img:hover{ transform: scale(1.2); }
<div> <button class="container"> <img src="http://i.imgur.com/IMiabf0.jpg"> </button> </div>
EDIT: another way if you have img not text 编辑:另一种方式,如果您有img不是文字
div.container { text-align: center; margin: 100px auto 0; } a { display: inline-block; background-color: #1984c3; color: #fff; font-size: 1.5em; font-family: 'Calibri', sans-serif; font-weight: lighter; padding: 1em 2em; text-decoration: none; text-transform: uppercase; -moz-transition: 0.3s; -webkit-transition: 0.3s; transition: 0.1s; } a:hover{ transform: scale(1.2); }
<div class="container"> <a href="#">Hi Im a Button</a> </div>
Example of padding.... 填充示例...
button{ transition: padding 1s; } button:hover { box-shadow: 0px 5px 5px #888888; padding:15px; }
<button><img src="#"/></button>
Transition is used to give the button an animated stretch and box-shadow for the pop-out effect. 过渡用于为按钮赋予动画的拉伸和阴影,以实现弹出效果。 This is just a quick example mainly to focus on the padding. 这只是一个快速示例,主要关注于填充。
I'm sure you can expand on this applying more styles to fit your needs. 我相信您可以在此基础上扩展样式,以应用更多样式来满足您的需求。 Any questions please leave a comment below and I will get back to you as soon as possible. 如有任何问题,请在下面留下评论,我会尽快与您联系。
I hope this helps. 我希望这有帮助。 Happy coding! 编码愉快!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.