博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Firefox Marketplace动画按钮
阅读量:2518 次
发布时间:2019-05-11

本文共 3073 字,大约阅读时间需要 10 分钟。

The is an incredibly attractive, easy to use hub that promises to make finding and promoting awesome HTML5-powered web applications easy and convenient. While I don't work directly on the Marketplace, I am privy to the codebase (and ). One of the well written and elegant touches to the site is its animated button. They are comprised completely of CSS and achieve a great effect by animating box-shadow and line-height.

是一个非常吸引人的,易于使用的中心,它有望使查找和推广基于HTML5的超赞Web应用程序变得轻松便捷。 虽然我不直接在Marketplace上工作,但我对代码库有所了解( 也是 )。 该网站的文字写法精美,风格优美,是其动画按钮。 它们完全由CSS组成,并且通过对box-shadowline-height动画效果达到了很好的效果。

HTML (The HTML)

These styles can be applied to A elements with the button class or actual BUTTON elements:

这些样式可以应用于具有按钮类的A元素或实际的BUTTON元素:

Arsenal Arsenal Arsenal

Since BUTTON elements have had styling quirks in the past, you'll want to use A elements everywhere outside of forms.

由于BUTTON元素过去曾有样式怪癖,因此您将希望在表单之外的任何地方使用A元素。

CSS (The CSS)

There's a lot of CSS in the basic element state, but I kept all of it to keep my demo true to the Marketplace button. Here's the magic:

基本元素状态下有很多CSS,但是为了使我的演示完全符合Marketplace按钮,我保留了所有这些内容。 这是魔术:

a.button:link,a.button:visited,button,input[type=submit],input[type=button] {	border: 0;	color: white;	display: inline-block;	font: 600 16px/31px "Open Sans","Helvetica Neue",Arial,sans-serif;	height: 32px;	background-color: 	#267CC2;	padding: 0 24px;	position: relative;	text-align: center;	text-decoration: none;	text-shadow: 0 1px 0 rgba(0, 0, 0, .25);	white-space: nowrap;	border-radius: .5em;	box-shadow: 0 2px 1px rgba(0, 0, 0, .2), inset 0 -1px 0 rgba(0, 0, 0, .2), inset 0 1px 0 0 rgba(255, 255, 255, .2);	background-color: #267CC2;	background-image: linear-gradient(#42A5E1, #267CC2);	transition-property: -moz-box-shadow,-webkit-box-shadow,box-shadow,line-height;	transition-duration: .2s,.2s,.2s,.2s;}a.button:hover,a.button:focus,button:hover,button:focus,input[type=submit]:hover,input[type=button]:hover,input[type=submit]:focus,input[type=button]:focus {    box-shadow: 0 4px 1px rgba(0, 0, 0, 0.2), 0 -3px 0 rgba(0, 0, 0, 0.2) inset;	line-height: 28px;	text-decoration: none;}a.button:active, button.button:active {    box-shadow: inset 0 2px 0 0 rgba(0, 0, 0, .2), inset 0 12px 24px 6px rgba(0, 0, 0, .2), inset 0 0 2px 2px rgba(0, 0, 0, .2);	transition-duration: .1s,.1s,.1s,.1s;	line-height: 34px;}

As you can probably guess, the original CSS was generated using a preprocessor (LESS, in this case). As with any piece of expertly written code, there isn't too much to explain. The animated transition is applied to box-shadow and line-height properties and the :active and :hover states trigger the animations.

您可能会猜到,原始CSS是使用预处理程序(在这种情况下为LESS)生成的。 与任何一段专业编写的代码一样,没有太多要解释的内容。 动画过渡将应用于box-shadowline-height属性,并且:active:hover状态将触发动画。

I love what the AMO and Marketplace team has done with this subtle effect. Not only is the effect smooth and unique, it requires no JavaScript and uses what have now become standard effect techniques. Love it!

我喜欢AMO和Marketplace团队在这种微妙效果方面所做的工作。 效果不仅流畅,独特,而且不需要JavaScript,并使用现在已成为标准效果技术的技术。 爱它!

翻译自:

转载地址:http://puvwd.baihongyu.com/

你可能感兴趣的文章
10个维修中最常见的蓝屏代码,值得收藏!
查看>>
indexOf、instanceOf、typeOf、valueOf详解
查看>>
好程序员web前端教程:对象
查看>>
十道海量数据处理面试题与十个方法大总结
查看>>
sql表操作的基础语法
查看>>
【hdoj_1049】Climbing Worm
查看>>
android 开发之 - 百度地图 key 的申请
查看>>
SQL切换真假状态标识字段
查看>>
MySQL的数据类型
查看>>
获取控件在运行时于屏幕中的位置
查看>>
删除多个重复记录
查看>>
Meteor Shower POJ - 3669
查看>>
urllib
查看>>
.Net内存程序集的DUMP(ProFile篇)
查看>>
《Linux命令行与shell脚本编程大全 第3版》高级Shell脚本编程---40
查看>>
NIOS II 中用结构体指示灯终于正常了
查看>>
CF1009F Dominant Indices - 题解
查看>>
memached实现tomcat的session共享
查看>>
django导出excel
查看>>
阿里云服务器CentOS6.9安装maven
查看>>