html实现信封效果,CSS3 过渡特性创建信封效果的联系表单_html/css_WEB-ITnose

最近给大家分享 CSS3 效果比较多,都是充分运用了 CSS3 来实现的。通过 CSS3 的新特性,我们创作出好的交互和效果的可能性大大增加。这篇文章中,我想与大家分享使用 CSS3 过渡特性实现的信封效果的联系表单。

效果演示 插件下载

CSS3 代码:

#form_wrap { overflow:hidden; height:446px; position:relative; top:0px;-webkit-transition: all 1s ease-in-out .3s;-moz-transition: all 1s ease-in-out .3s;-o-transition: all 1s ease-in-out .3s;transition: all 1s ease-in-out .3s;}#form_wrap:before {content:"";position:absolute;bottom:128px;left:0px;background:url('images/before.png');width:530px;height: 316px;}#form_wrap:after {content:"";position:absolute;bottom:0px;left:0;background:url('images/after.png');width:530px;height: 260px; }#form_wrap.hide:after, #form_wrap.hide:before {display:none; }#form_wrap:hover {height:776px;top:-200px;}form {background:#f7f2ec url('images/letter_bg.png'); position:relative;top:200px;overflow:hidden;height:200px;width:400px;margin:0px auto;padding:20px; border: 1px solid #fff;border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;box-shadow: 0px 0px 3px #9d9d9d, inset 0px 0px 27px #fff;-moz-box-shadow: 0px 0px 3px #9d9d9d, inset 0px 0px 14px #fff;-webkit-box-shadow: 0px 0px 3px #9d9d9d, inset 0px 0px 27px #fff;-webkit-transition: all 1s ease-in-out .3s;-moz-transition: all 1s ease-in-out .3s;-o-transition: all 1s ease-in-out .3s;transition: all 1s ease-in-out .3s;}#form_wrap:hover form {height:530px;}label {margin: 11px 20px 0 0; font-size: 16px; color: #b3aba1;text-transform: uppercase; text-shadow: 0px 1px 0px #fff;}input[type=text], textarea {font: 14px normal normal uppercase helvetica, arial, serif;color: #7c7873;background:none;width: 380px; height: 36px; padding: 0px 10px; margin: 0 0 10px 0;border:1px solid #f8f5f1;-moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;-moz-box-shadow: inset 0px 0px 1px #726959;-webkit-box-shadow: inset 0px 0px 1px #b3a895; box-shadow: inset 0px 0px 1px #b3a895;}textarea { height: 80px; padding-top:14px;}textarea:focus, input[type=text]:focus {background:rgba(255,255,255,.35);}#form_wrap input[type=submit] {position:relative;font-family: 'YanoneKaffeesatzRegular'; font-size:24px; color: #7c7873;text-shadow:0 1px 0 #fff;width:100%; text-align:center;opacity:0;background:none;cursor: pointer;-moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; -webkit-transition: opacity .6s ease-in-out 0s;-moz-transition: opacity .6s ease-in-out 0s;-o-transition: opacity .6s ease-in-out 0s;transition: opacity .6s ease-in-out 0s;}#form_wrap:hover input[type=submit] {z-index:1;opacity:1;-webkit-transition: opacity .5s ease-in-out 1.3s;-moz-transition: opacity .5s ease-in-out 1.3s;-o-transition: opacity .5s ease-in-out 1.3s;transition: opacity .5s ease-in-out 1.3s;}#form_wrap:hover input:hover[type=submit] {color:#435c70;}

声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是一个简的使用 CSS 和 JavaScript 实现自动打开信封效果的示例: ```html <!DOCTYPE html> <html> <head> <style> /* 设置信封的样式 */ .envelope { position: relative; width: 300px; height: 200px; background-color: #fff; border: 2px solid #333; border-radius: 10px; overflow: hidden; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } /* 设置信封上的盖子样式 */ .envelope:before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 50px; background-color: #fff; transform-origin: top left; transform: rotate(-45deg); box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } /* 设置信封上的信封口样式 */ .envelope:after { content: ""; position: absolute; top: 48px; left: 50%; width: 100px; height: 20px; background-color: #fff; border: 2px solid #333; border-radius: 0 0 10px 10px; transform: translateX(-50%); box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } /* 设置信封里面的信件样式 */ .letter { position: absolute; top: 50px; left: 0; width: 100%; height: calc(100% - 50px); background-color: #f7f2e7; padding: 20px; box-sizing: border-box; transform-origin: top; transform: rotateX(90deg); transition: transform 1s; } /* 设置打开信封的动画 */ .envelope.open .letter { transform: rotateX(0); } </style> </head> <body> <div class="envelope" onclick="this.classList.add('open')"> <div class="letter"> <p>这是一封信,内容在这里。</p> </div> </div> </body> </html> ``` 在上面的代码中,我们首先设置了一个 envelope 类的 div 元素作为信封的容器,并设置了它的样式,包括宽度、高度、背景颜色、边框、圆角、溢出隐藏和阴影等属性。然后使用 :before 和 :after 伪元素分别信封上的盖子和信封口,并设置它们的样式。接着,使用一个 letter 类的 div 元素信封里面的信件,并设置它的样式,包括宽度、高度、背景颜色、内边距、盒模型和旋转等属性。最后使用 JavaScript 给 envelope 元素添加一个 click 事件处理函数,当用户点击信封时,给 envelope 元素添加一个 open 类,触发打开信封的动画效果

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值