按钮按下效果

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>按钮按下效果</title>
<style type="text/css">
#div1{ width:120px; height:40px; line-height:40px; text-align:center; color:#fff; background:#039; text-shadow:1px 1px 2px #000; box-shadow:0 5px 2px #000; position:relative; top:0; cursor:pointer; margin:0 auto;}
#div1:active{ top:3px; box-shadow:0 2px 2px #000;}
</style>
<script type="text/javascript"></script>
</head>

<body>
    <div id="div1">按钮</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>按钮按下效果</title>
<style type="text/css">
#div1{ width:120px; height:40px; line-height:40px; text-align:center; color:#fff; background:#039; text-shadow:1px 1px 2px #000; border-radius:5px; box-shadow:inset 0px 0px 20px #fff, 0 5px 2px #000; position:relative; top:0; transition:0.2s all ease; margin:50px auto; cursor:pointer;}
#div1:hover{ box-shadow:inset 0px 0px 40px #fff, 0 5px 2px #000;}
#div1:active{ top:3px; box-shadow:inset 0px 0px 40px #fff, 0 2px 2px #000;}
</style>
<script type="text/javascript"></script>
</head>

<body>
    <div id="div1">按钮</div>
</body>
</html>
时间: 2024-07-31 18:45:43

按钮按下效果的相关文章

android 按钮按下效果(文字颜色和按钮同时变化)

styles: <style name="ButtonGreen" parent="@android:style/Widget.Button"> <item name="android:textSize">18.0sp</item> <item name="android:textColor">@drawable/skin_color_button</item> &l

关于上一篇鼠标移到按钮时的“按下”效果的三种方法

上一篇博文中,关于按钮按下的效果回过头研究了下,总结了如下三种方法,只写出关键样式: 1.相对定位 1 input.button{ 2 3 position:relative; //用相对定位 4 } 5 6 input.button:hover{ 7 top:2px;//鼠标移动到此top增加2px 8 } 2.主要利用外边距这个属性,鼠标移动到按钮位置时,按钮上外边距增加2px,下外边距减少2px(相当于走出去2px又退回来2px),就可以达到按下效果,如果只是单独写margin-top:2

定义一个按钮按下显示遮盖层的效果

1.点击按钮,出现遮盖层,松开按钮,遮盖层消失 2. 长按按钮,出现遮盖层,松开按钮,遮盖层消失 3. 点击按钮,出现遮盖层,拖拽按钮,遮盖层消失 UIButton *btnBottom = [[UIButton alloc]initWithFrame:CGRectMake(1,1,100,100)]; [btnBottom addTarget:self action:@selector(buttonClickTouchDown:) forControlEvents:UIControlEvent

Android下实现win8的按钮点击效果

原理就是自定义一个imageButton,实现动画效果 demo源码下载地址:  请戳这里----------------> 关于回弹张力的效果扩展,可以参考Facebook的开源动画库rebound: https://github.com/facebook/rebound Android下实现win8的按钮点击效果

按钮点击效果(水波纹)

近来看到个不错的按钮点击效果,当点击时产生一次水波涟漪效果,挺好玩的,于是简单的实现了下(没考虑低版本浏览器兼容问题) 先看看效果吧,如下图(录制gif软件有点渣,看起来卡卡的...) 这种效果可以由元素内嵌套canves实现,也可以由css3实现. Canves实现 网上摘了一份canves实现的代码,略微去掉了些重复定义的样式并且给出js注释,代码如下 html代码 <a class="btn color-1 material-design" data-color="

Android Ripple 按钮水波纹效果(二)优化

上一篇中我们讲了自定义ripple 水波纹效果,先来回顾一下效果吧! 看了以后感觉没甚么问题,我一开始也觉得很满意了,那好,我们拿Android 5.0自带的效果来对比一下 发现了不同之处没?点击中间的时候是看不出什么区别,但是点击两边的时候,就很明显了,我们自定义的效果,波纹向两边同速度的扩散,所以就会出现,如果点击点不在中心的时候,距离短的一边波纹先到达,而距离长的一边后到达,不能同时到达边缘!而系统自带的则不存在这种情况,所以这是一个优化点;另一个优化点是:我们自定义的效果,在波纹全部覆盖

ios按钮点击后翻转效果

代码是网上找到的,不过找到的时候直接复制下来不能用,稍微整理下,为和我一样水平的菜鸟观摩一下下. (1)引入“QuartzCore.framework”库,头部引用. C代码   #include<QuartzCore/CoreAnimation.h> (2)直接上代码,你懂的. C代码   -(IBAction)buttonP:(id)sender{ [self buttonAnimation:sender]; } - (CAAnimation *) animationRotate { CA

Android Ripple 按钮水波纹效果(一)

看到android 5.0有一个按钮点击效果非常棒,先来看效果图: 但是这种效果只能在5.0的系统上有效果,如何在低版本上实现呢? 这种效果网上也有人实现了, blog 地址http://blog.csdn.net/singwhatiwanna/article/details/42614953 ok,直接进入主题, 要实现这种动画效果也不难,原理可以用一句话概括:就是,在我们按下view的时候,从按下的位置开始绘制圆,圆的半径一直增大,直至把View全部覆盖掉. 通过实现原理我们可以分析出,要实

Android-ListView小技巧-去除按下效果及底部分割线

在xml文件中加入 1.去除按下效果: android:listSelector="@android:color/transparent" 当然,如果需要其它的效果的话,自己定义一个选择器就ok了: 2.去除底部分割线: android:divider="@android:color/transparent"