CSS3の新特性
来源:互联网 发布:黑魂三捏脸数据女 编辑:程序博客网 时间:2024/06/05 04:13
CSS3の新特性
常用属性
不同浏览器对应不同前缀,Chrome(-webkit-),IE(-ms-),Firefox(-moz-)
transform:变形
<style type="text/css">div { transform: rotate(10deg); /*变形*/ -ms-transform: rotate(10deg); -webkit-transform: rotate(10deg); -moz-transform: rotate(10deg);}</style>
border-radius:圆角
<style type="text/css">div { border-radius: 10px; /*圆角半径*/ -webkit-border-radius: 10px; -moz-border-radius: 10px;}</style>
box-shadow:盒阴影,rgba最后一个值表示透明度
<style type="text/css">div { box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2); /*盒阴影*/ -webkit-box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2); -moz-box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2);}</style>
background:设置背景色渐变
<style type="text/css">div { background: linear-gradient(to bottom right, orange, yellow); /*背景色渐变*/ background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow);}</style>
@keyframes:动画声明
/*动画*/<style type="text/css"> @keyframes action-movie { 0% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 25% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 50% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 75% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 100% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } } @-moz-keyframes action-movie { 0% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 25% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 50% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 75% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 100% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } }</style>
完整实例
<!DOCTYPE html><html lang="zh"><head> <meta charset="UTF-8"> <noscript>Your browser does not support JavaScript pluin</noscript> <script type="text/javascript"> </script> <style type="text/css"> #information { width:150px; height: 150px; margin:15px auto; transform: rotate(10deg); /*变形*/ -ms-transform: rotate(10deg); -webkit-transform: rotate(10deg); -moz-transform: rotate(10deg); border-radius: 10px; /*圆角半径*/ -webkit-border-radius: 10px; -moz-border-radius: 10px; box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2); /*盒阴影*/ -webkit-box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2); -moz-box-shadow: 5px 10px 16px 2px rgba(0, 0, 0, 0.2); background: linear-gradient(to bottom right, orange, yellow); /*背景色渐变*/ background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } /*动画*/ @keyframes action-movie { 0% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 25% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 50% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 75% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 100% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } } @-moz-keyframes action-movie { 0% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 25% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 50% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } 75% { background: linear-gradient(to bottom right, orange, yellow); background: -webkit-linear-gradient(to bottom right, orange, yellow); background: -moz-linear-gradient(to bottom right, orange, yellow); background: -o-linear-gradient(to bottom right, orange, yellow); } 100% { background: linear-gradient(to bottom right, yellow, orange); background: -webkit-linear-gradient(to bottom right, yellow, orange); background: -moz-linear-gradient(to bottom right, yellow, orange); background: -o-linear-gradient(to bottom right, yellow, orange); } } div #information:hover { -webkit-animation: action-movie 5s; -o-animation: action-movie 5s; -moz-animation: action-movie 5s; animation: action-movie 5s; } #operate { text-align: center; display: none; } #word { font-size: xx-large; text-shadow: 5px 10px 16px rgba(0, 0, 0, 0.3); } </style></head><body> <div id="status"> <div id="information"></div> <div id="detail"> <span id="word">Successfully.</span> </div> </div> <div id="operate"> <button type="button" onclick="">click</button> </div></body></html>
联系我
0 0
- CSS3の新特性
- CSS3新特性
- CSS3的新特性
- CSS3新特性一览
- CSS3新特性
- CSS3新特性简介
- CSS3新特性
- css3+html5新特性
- CSS3 新特性小结
- CSS3新的特性
- CSS3新特性学习
- css3新特性
- CSS3 新特性实例
- css3新特性
- CSS3新特性(一)
- CSS3新特性(二)
- CSS3新特性
- CSS3新特性概览
- bnuoj 51275(道路修建-并查集按秩合并)
- 你只是看起来很努力
- Tcl -- eval
- HttpClient的请求超时和响应超时
- ssh(struts2.3.8+spring3.2+heibernate4.1+annotation零配置
- CSS3の新特性
- 20160203.CCPP体系详解(0013天)
- (转)JAVA中堆和栈的区别
- android studio 提示Error:Default Activity not found
- HTTP 请求方式: GET和POST的比较
- 8大Android调试工具
- CSDN 博客积分 如何获取
- MessageBox语法介绍
- LeetCode - Increasing Triplet Subsequence