干货分享 超炫丽的HTML5/jQuery应用及代码
今天我们要来分享一些HTML5干货,对于前段开发者来说,这些HTML5应用和jQuery插件将会让你的项目更加生动和炫丽,至少在UI设计方面,或多或少会带给你一点设计灵感,赶紧收藏和分享吧。另外这些HTML5应用的源代码也一并分享了。
HTML5 Canvas画板画图工具 可定义笔刷和画布
这是一款基于HTML5 Canvas的网络画板应用,简化版的,可以自己在上面扩展。
核心jQuery代码:
- function prepareCanvas()
- {
- // Create the canvas (Neccessary for IE because it doesn't know what a canvas element is)
- var canvasDiv = document.getElementById('canvasDiv');
- canvas = document.createElement('canvas');
- canvas.setAttribute('width', canvasWidth);
- canvas.setAttribute('height', canvasHeight);
- canvas.setAttribute('id', 'canvas');
- canvasDiv.appendChild(canvas);
- if(typeof G_vmlCanvasManager != 'undefined') {
- canvas = G_vmlCanvasManager.initElement(canvas);
- }
- context = canvas.getContext("2d"); // Grab the 2d canvas context
- // Note: The above code is a workaround for IE 8 and lower. Otherwise we could have used:
- // context = document.getElementById('canvas').getContext("2d");
- // Load images
- // -----------
- crayonImage.onload = function() { resourceLoaded();
- };
- crayonImage.src = "images/crayon-outline.png";
- //context.drawImage(crayonImage, 0, 0, 100, 100);
- markerImage.onload = function() { resourceLoaded();
- };
- markerImage.src = "images/marker-outline.png";
- eraserImage.onload = function() { resourceLoaded();
- };
- eraserImage.src = "images/eraser-outline.png";
- crayonBackgroundImage.onload = function() { resourceLoaded();
- };
- crayonBackgroundImage.src = "images/crayon-background.png";
- markerBackgroundImage.onload = function() { resourceLoaded();
- };
- markerBackgroundImage.src = "images/marker-background.png";
- eraserBackgroundImage.onload = function() { resourceLoaded();
- };
- eraserBackgroundImage.src = "images/eraser-background.png";
- crayonTextureImage.onload = function() { resourceLoaded();
- };
- crayonTextureImage.src = "images/crayon-texture.png";
- outlineImage.onload = function() { resourceLoaded();
- };
- outlineImage.src = "images/watermelon-duck-outline.png";
- // Add mouse events
- // ----------------
- $('#canvas').mousedown(function(e)
- {
- // Mouse down location
- var mouseX = e.pageX - this.offsetLeft;
- var mouseY = e.pageY - this.offsetTop;
- if(mouseX < drawingAreaX) // Left of the drawing area
- {
- if(mouseX > mediumStartX)
- {
- if(mouseY > mediumStartY && mouseY < mediumStartY + mediumImageHeight){
- curColor = colorPurple;
- }else if(mouseY > mediumStartY + mediumImageHeight && mouseY < mediumStartY + mediumImageHeight * 2){
- curColor = colorGreen;
- }else if(mouseY > mediumStartY + mediumImageHeight * 2 && mouseY < mediumStartY + mediumImageHeight * 3){
- curColor = colorYellow;
- }else if(mouseY > mediumStartY + mediumImageHeight * 3 && mouseY < mediumStartY + mediumImageHeight * 4){
- curColor = colorBrown;
- }
- }
- }
- else if(mouseX > drawingAreaX + drawingAreaWidth) // Right of the drawing area
- {
- if(mouseY > toolHotspotStartY)
- {
- if(mouseY > sizeHotspotStartY)
- {
- var sizeHotspotStartX = drawingAreaX + drawingAreaWidth;
- if(mouseY < sizeHotspotStartY + sizeHotspotHeight && mouseX > sizeHotspotStartX)
- {
- if(mouseX < sizeHotspotStartX + sizeHotspotWidthObject.huge){
- curSize = "huge";
- }else if(mouseX < sizeHotspotStartX + sizeHotspotWidthObject.large + sizeHotspotWidthObject.huge){
- curSize = "large";
- }else if(mouseX < sizeHotspotStartX + sizeHotspotWidthObject.normal + sizeHotspotWidthObject.large + sizeHotspotWidthObject.huge){
- curSize = "normal";
- }else if(mouseX < sizeHotspotStartX + sizeHotspotWidthObject.small + sizeHotspotWidthObject.normal + sizeHotspotWidthObject.large + sizeHotspotWidthObject.huge){
- curSize = "small";
- }
- }
- }
- else
- {
- if(mouseY < toolHotspotStartY + toolHotspotHeight){
- curTool = "crayon";
- }else if(mouseY < toolHotspotStartY + toolHotspotHeight * 2){
- curTool = "marker";
- }else if(mouseY < toolHotspotStartY + toolHotspotHeight * 3){
- curTool = "eraser";
- }
- }
- }
- }
- else if(mouseY > drawingAreaY && mouseY < drawingAreaY + drawingAreaHeight)
- {
- // Mouse click location on drawing area
- }
- paint = true;
- addClick(mouseX, mouseY, false);
- redraw();
- });
- $('#canvas').mousemove(function(e){
- if(paint==true){
- addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true);
- redraw();
- }
- });
- $('#canvas').mouseup(function(e){
- paint = false;
- redraw();
- });
- $('#canvas').mouseleave(function(e){
- paint = false;
- });
- }
HTML5/CSS3滑块动画菜单 图标动画很酷
非常实用的鼠标跟随滑动菜单,挺不错的。
核心CSS代码:
- #menu ul{
- position:relative;
- }
- #menu ul:after{
- content:"";
- display:block;
- clear:both;
- }
- #menu a{
- color:#D8D8D8;
- text-decoration:none;
- display:block;
- width:100%;
- height:100%;
- text-shadow: 0 -1px 0 #000;
- }
- #menu li:after {
- content: "";
- width: 9.5238%;
- height: 100%;
- position: absolute;
- top:;
- right: -9.5238%;
- background: url('css/menu-bg.png');
- }
- .rocket:before {
- content: "";
- width: 9.5238%;
- height: 100%;
- position: absolute;
- top:;
- left: -9.5238%;
- background: url('css/menu-bg.png');
- border-radius: 5px 0px 0px 5px;
- }
- .earth:after{
- border-radius:0px 5px 5px 0px;
- }
- .current{
- position:absolute;
- top:-13px;
- left:8.92857%;
- margin-left: -49px;
- width:95px;
- height:165px;
- -webkit-transition: all 400ms cubic-bezier(.45,1.92,.9,1.54);
- -moz-transition: all 400ms cubic-bezier(.45,1.92,.9,1.54);
- -o-transition: all 400ms cubic-bezier(.45,1.92,.9,1.54);
- -ms-transition: all 400ms cubic-bezier(.45,1.92,.9,1.54);
- transition: all 400ms cubic-bezier(.16,1.23,.87,1.18);
- }
- .current-back{
- width:100%;
- height:100%;
- position:absolute;
- background:#c39449;
- border-radius:5px;
- border-bottom: 2px solid rgba(0, 0, 0, 0.09);
- border-top: 2px solid rgba(255,255,255,0.1);
- }
- .top-arrow{
- position:absolute;
- overflow:hidden;
- width:100%;
- height:12px;
- top:13px;
- left:;
- z-index:;
- }
- .top-arrow:before{
- content:"";
- position:absolute;
- width:80%;
- height:10px;
- top:-10px;
- left:10%;
- border-radius:20%;
- box-shadow:0 0 10px black;
- }
- .top-arrow:after{
- content:"";
- position:absolute;
- width:;
- height:;
- top:0px;
- border-top:8px solid #c39449;
- border-left:6px solid transparent;
- border-right:6px solid transparent;
- margin-left:-6px;
- left:50%;
- }
- .bottom-arrow{
- position:absolute;
- overflow:hidden;
- width:100%;
- height:12px;
- bottom:17px;
- left:;
- z-index:;
- }
- .bottom-arrow:before{
- content:"";
- position:absolute;
- width:80%;
- height:10px;
- bottom:-10px;
- left:10%;
- border-radius:20%;
- box-shadow:0 0 10px black;
- }
- .bottom-arrow:after{
- content:"";
- position:absolute;
- width:;
- height:;
- bottom:;
- border-bottom:12px solid #c39449;
- border-left:8px solid transparent;
- border-right:8px solid transparent;
- margin-left:-8px;
- left:50%;
- }
- .wine:hover ~ .current{
- left: 25.5%;
- }
- .burger:hover ~ .current{
- left: 42%;
- }
- .comment:hover ~ .current{
- left: 58.5%;
- }
- .sport:hover ~ .current{
- left: 75%;
- }
- .earth:hover ~ .current{
- left: 91.1%;
- }
HTML5/CSS3 3D文字特效 文字外翻效果
一款基于HTML5的3D文字特效。
核心CSS代码:
- .letter{
- display: inline-block;
- font-weight:;
- font-size: 8em;
- margin: 0.2em;
- position: relative;
- color: #00B4F1;
- transform-style: preserve-3d;
- perspective:;
- z-index:;
- }
- .letter:before, .letter:after{
- position:absolute;
- content: attr(data-letter);
- transform-origin: top left;
- top:;
- left:;
- }
- .letter, .letter:before, .letter:after{
- transition: all 0.3s ease-in-out;
- }
- .letter:before{
- color: #fff;
- text-shadow:
- -1px 0px 1px rgba(255,255,255,.8),
- 1px 0px 1px rgba(0,0,0,.8);
- z-index:;
- transform:
- rotateX(0deg)
- rotateY(-15deg)
- rotateZ(0deg);
- }
- .letter:after{
- color: rgba(0,0,0,.11);
- z-index:;
- transform:
- scale(1.08,1)
- rotateX(0deg)
- rotateY(0deg)
- rotateZ(0deg)
- skew(0deg,1deg);
- }
- .letter:hover:before{
- color: #fafafa;
- transform:
- rotateX(0deg)
- rotateY(-40deg)
- rotateZ(0deg);
- }
- .letter:hover:after{
- transform:
- scale(1.08,1)
- rotateX(0deg)
- rotateY(40deg)
- rotateZ(0deg)
- skew(0deg,22deg);
- }
CSS3波浪形菜单 结合背景超级绚丽
一款非常具有创意的CSS3菜单,波浪形状的。
核心CSS代码:
- .b-nav {
- overflow: hidden;
- position: relative;
- margin: 3em auto 0;
- width: 28em; height: 10em;
- }
- .b-menu {
- width:; height:;
- list-style: none;
- }
- .b-menu li {
- overflow: hidden;
- position: absolute;
- width: 12em; height: 12em;
- }
- .b-menu li:nth-child(-n+3) {
- top: 0.66em; left: -5.68em;
- transform-origin: 100% 100%;
- }
- .b-menu li:nth-child(n+4) {
- right: -5.69em; bottom: 0.66em;
- transform-origin: 0 0;
- }
- .b-menu li:first-child {
- transform: skewY(67.5deg);
- }
- .b-menu li:nth-child(2) {
- transform: rotate(22.5deg) skewY(67.5deg);
- }
- .b-menu li:nth-child(3) {
- transform: rotate(45deg) skewY(67.5deg);
- }
- .b-menu li:nth-child(4) {
- transform: skewY(67.5deg);
- }
- .b-menu li:nth-child(5) {
- transform: rotate(22.5deg) skewY(67.5deg);
- }
- .b-menu li:last-child {
- transform: rotate(45deg) skewY(67.5deg);
- }
- .b-menu a, .b-menu li:after {
- position: absolute;
- border-radius: 50%;
- box-shadow: 0 0 .2em black, inset 0 0 .2em black;
- transform: skewY(-67.5deg) rotate(-11.25deg);
- }
- .b-menu a {
- width: 200%; height: 200%;
- opacity: .7;
- background: radial-gradient(transparent 57.3%,
- #c9c9c9 57.7%);
- color: #7a8092;
- font: 900 1em/2.5 sans-serif;
- text-align: center;
- text-decoration: none;
- transition: .5s;
- }
- .b-menu li:nth-child(n+4) a {
- top: -100%; left: -100%;
- line-height: 45.5;
- }
- .b-menu a:hover { opacity:; }
- .b-menu li:after {
- top: 19%; left: 19%;
- width: 162%; height: 162%;
- content: '';
- }
- .b-menu li:nth-child(n+4):after {
- top: auto; right: 19%; bottom: 19%; left: auto;
- }
- .b-menu:before, .b-menu:after {
- position: absolute;
- width: 1em; height: 2.1em;
- opacity: .7;
- background: #c9c9c9;
- content: '';
- }
- .b-menu:before {
- top: 1.75em; left: 1.21em;
- border-radius: 100% 0 0 100%/ 50% 0 0 50%;
- transform: rotate(-22.5deg);
- }
- .b-menu:after {
- bottom: 1.75em; right: 1.21em;
- border-radius: 0 100% 100% 0/ 0 50% 50% 0;
- transform: rotate(-22.5deg);
- }
HTML5/CSS3时尚的圆盘时钟动画 带当前日期
又是一款HTML5圆盘时钟动画。
核心CSS代码:
- #watch .minute-marks li:first-child {transform:rotate(6deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(2) {transform:rotate(12deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(3) {transform:rotate(18deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(4) {transform:rotate(24deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(5) {transform:rotate(36deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(6) {transform:rotate(42deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(7) {transform:rotate(48deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(8) {transform:rotate(54deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(9) {transform:rotate(66deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(10) {transform:rotate(72deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(11) {transform:rotate(78deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(12) {transform:rotate(84deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(13) {transform:rotate(96deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(14) {transform:rotate(102deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(15) {transform:rotate(108deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(16) {transform:rotate(114deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(17) {transform:rotate(126deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(18) {transform:rotate(132deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(19) {transform:rotate(138deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(20) {transform:rotate(144deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(21) {transform:rotate(156deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(22) {transform:rotate(162deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(23) {transform:rotate(168deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(24) {transform:rotate(174deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(25) {transform:rotate(186deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(26) {transform:rotate(192deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(27) {transform:rotate(198deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(28) {transform:rotate(204deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(29) {transform:rotate(216deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(30) {transform:rotate(222deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(31) {transform:rotate(228deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(32) {transform:rotate(234deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(33) {transform:rotate(246deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(34) {transform:rotate(252deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(35) {transform:rotate(258deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(36) {transform:rotate(264deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(37) {transform:rotate(276deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(38) {transform:rotate(282deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(39) {transform:rotate(288deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(40) {transform:rotate(294deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(41) {transform:rotate(306deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(42) {transform:rotate(312deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(43) {transform:rotate(318deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(44) {transform:rotate(324deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(45) {transform:rotate(336deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(46) {transform:rotate(342deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(47) {transform:rotate(348deg) translateY(-12.7em)}
- #watch .minute-marks li:nth-child(48) {transform:rotate(354deg) translateY(-12.7em)}
- #watch .digits {
- width:30em;
- height:30em;
- border-radius:15em;
- position:absolute;
- top:; left:50%;
- margin-left:-15em;
- }
- #watch .digits li {
- font-size:1.6em;
- display:block;
- width:1.6em;
- height:1.6em;
- position:absolute;
- top:50%; left:50%;
- line-height:1.6em;
- text-align:center;
- margin:-.8em 0 0 -.8em;
- font-weight:bold;
- }
- #watch .digits li:nth-child(1) { transform:translate(3.9em, -6.9em) }
- #watch .digits li:nth-child(2) { transform:translate(6.9em, -4em) }
- #watch .digits li:nth-child(3) { transform:translate(8em, 0) }
- #watch .digits li:nth-child(4) { transform:translate(6.8em, 4em) }
- #watch .digits li:nth-child(5) { transform:translate(3.9em, 6.9em) }
- #watch .digits li:nth-child(6) { transform:translate(0, 8em) }
- #watch .digits li:nth-child(7) { transform:translate(-3.9em, 6.9em) }
- #watch .digits li:nth-child(8) { transform:translate(-6.8em, 4em) }
- #watch .digits li:nth-child(9) { transform:translate(-8em, 0) }
- #watch .digits li:nth-child(10) { transform:translate(-6.9em, -4em) }
- #watch .digits li:nth-child(11) { transform:translate(-3.9em, -6.9em) }
- #watch .digits li:nth-child(12) { transform:translate(0, -8em) }
- #watch .digits:before {
- content:'';
- width:1.6em;
- height:1.6em;
- border-radius:.8em;
- position:absolute;
- top:50%; left:50%;
- margin:-.8em 0 0 -.8em;
- background:#121314;
- }
- #watch .digits:after {
- content:'';
- width:4em;
- height:4em;
- border-radius:2.2em;
- position:absolute;
- top:50%; left:50%;
- margin:-2.1em 0 0 -2.1em;
- border:.1em solid #c6c6c6;
- background:-webkit-radial-gradient(center, ellipse cover, rgba(200,200,200,0), rgba(190,190,190,1) 90%, rgba(130,130,130,1) 100%);
- background:-moz-radial-gradient(center, ellipse cover, rgba(200,200,200,0), rgba(190,190,190,1) 90%, rgba(130,130,130,1) 100%);
- background:radial-gradient(ellipse at center, rgba(200,200,200,0), rgba(190,190,190,1) 90%, rgba(130,130,130,1) 100%);
- }
- @keyframes hours { to {transform:rotate(335deg)} }
- #watch .hours-hand {
- width:.8em;
- height:7em;
- border-radius:0 0 .9em .9em;
- background:#232425;
- position:absolute;
- bottom:50%; left:50%;
- margin:0 0 -.8em -.4em;
- box-shadow:#232425 0 0 2px;
- transform-origin:0.4em 6.2em;
- transform:rotate(-25deg);
- animation:hours 43200s linear 0s infinite;
- }
- #watch .hours-hand:before {
- content:'';
- background:inherit;
- width:1.8em;
- height:.8em;
- border-radius:0 0 .8em .8em;
- box-shadow:#232425 0 0 1px;
- position:absolute;
- top:-.7em; left:-.5em;
- }
- #watch .hours-hand:after {
- content:'';
- width:; height:;
- border:.9em solid #232425;
- border-width:0 .9em 2.4em .9em;
- border-left-color:transparent;
- border-right-color:transparent;
- position:absolute;
- top:-3.1em; left:-.5em;
- }
- @keyframes minutes { to {transform:rotate(422deg)} }
- #watch .minutes-hand {
- width:.8em;
- height:12.5em;
- border-radius:.5em;
- background:#343536;
- position:absolute;
- bottom:50%; left:50%;
- margin:0 0 -1.5em -.4em;
- box-shadow:#343536 0 0 2px;
- transform-origin:0.4em 11em;
- transform:rotate(62deg);
- animation:minutes 3600s linear 0s infinite;
- }
- @keyframes seconds { to {transform:rotate(480deg)} }
- #watch .seconds-hand {
- width:.2em;
- height:14em;
- border-radius:.1em .1em 0 0/10em 10em 0 0;
- background:#c00;
- position:absolute;
- bottom:50%; left:50%;
- margin:0 0 -2em -.1em;
- box-shadow:rgba(0,0,0,.8) 0 0 .2em;
- transform-origin:0.1em 12em;
- transform:rotate(120deg);
- animation:seconds 60s steps(60, end) 0s infinite;
- }
- #watch .seconds-hand:after {
- content:'';
- width:1.4em;
- height:1.4em;
- border-radius:.7em;
- background:inherit;
- position:absolute;
- left:-.65em; bottom:1.35em;
- }
- #watch .seconds-hand:before {
- content:'';
- width:.8em;
- height:3em;
- border-radius:.2em .2em .4em .4em/.2em .2em 2em 2em;
- box-shadow:rgba(0,0,0,.8) 0 0 .2em;
- background:inherit;
- position:absolute;
- left:-.35em; bottom:-3em;
- }
- #watch .digital-wrap {
- width:9em;
- height:3em;
- border:.1em solid #222;
- border-radius:.2em;
- position:absolute;
- top:50%; left:50%;
- margin:3em 0 0 -4.5em;
- overflow:hidden;
- background:#4c4c4c;
- background:-webkit-linear-gradient(top, #4c4c4c 0%,#0f0f0f 100%);
- background:-moz-linear-gradient(top, #4c4c4c 0%, #0f0f0f 100%);
- background:-ms-linear-gradient(top, #4c4c4c 0%,#0f0f0f 100%);
- background:-o-linear-gradient(top, #4c4c4c 0%,#0f0f0f 100%);
- background:linear-gradient(to bottom, #4c4c4c 0%,#0f0f0f 100%);
- }
- #watch .digital-wrap ul {
- float:left;
- width:2.85em;
- height:3em;
- border-right:.1em solid #000;
- color:#ddd;
- font-family:Consolas, monaco, monospace;
- }
- #watch .digital-wrap ul:last-child { border:none }
- #watch .digital-wrap li {
- font-size:1.5em;
- line-height:;
- letter-spacing:2px;
- text-align:center;
- position:relative;
- left:1px;
- }
- #watch .digit-minutes li {
- animation:dsm 3600s steps(60, end) 0s infinite;
- }
- #watch .digit-seconds li {
- animation:dsm 60s steps(60, end) 0s infinite;
- }
- @keyframes dsm {
- to { transform:translateY(-120em) }
- }
CSS3带图标提示插件 多主题颜色
一款基于CSS3样式提示框插件,色彩比较丰富。
CSS3漂亮的自定义checkbox复选框 9款迷人样式
很酷的CSS3自定义checkbox插件,样式很丰富。
HTML5/CSS3发光搜索表单 超酷CSS3表单
CSS3悬停动画工具提示效果
HTML5自定义Checkbox和Radiobox 很酷的选中动画
非常不错的一款HTML5 教程,可以让你自定义checkbox和radiobox。
核心CSS代码:
- .check-box {
- width: 22px;
- height: 22px;
- cursor: pointer;
- display: inline-block;
- margin: 2px 7px 0 0;
- position: relative;
- overflow: hidden;
- box-shadow: 0 0 1px #ccc;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- background: rgb(255, 255, 255);
- background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(47%, rgba(246, 246, 246, 1)), color-stop(100%, rgba(237, 237, 237, 1)));
- background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -o-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -ms-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
- border: 1px solid #ccc;
- }
- .check-box i {
- background: url('css/check_mark.png') no-repeat center center;
- position: absolute;
- left: 3px;
- bottom: -15px;
- width: 16px;
- height: 16px;
- opacity: .5;
- -webkit-transition: all 400ms ease-in-out;
- -moz-transition: all 400ms ease-in-out;
- -o-transition: all 400ms ease-in-out;
- transition: all 400ms ease-in-out;
- -webkit-transform:rotateZ(-180deg);
- -moz-transform:rotateZ(-180deg);
- -o-transform:rotateZ(-180deg);
- transform:rotateZ(-180deg);
- }
- .checkedBox {
- -moz-box-shadow: inset 0 0 5px 1px #ccc;
- -webkit-box-shadow: inset 0 0 5px 1px #ccc;
- box-shadow: inset 0 0 5px 1px #ccc;
- border-bottom-color: #fff;
- }
- .checkedBox i {
- bottom: 2px;
- -webkit-transform:rotateZ(0deg);
- -moz-transform:rotateZ(0deg);
- -o-transform:rotateZ(0deg);
- transform:rotateZ(0deg);
- }
- /*Custom radio button*/
- .radio-btn {
- width: 20px;
- height: 20px;
- display: inline-block;
- float: left;
- margin: 3px 7px 0 0;
- cursor: pointer;
- position: relative;
- -webkit-border-radius: 100%;
- -moz-border-radius: 100%;
- border-radius: 100%;
- border: 1px solid #ccc;
- box-shadow: 0 0 1px #ccc;
- background: rgb(255, 255, 255);
- background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(47%, rgba(246, 246, 246, 1)), color-stop(100%, rgba(237, 237, 237, 1)));
- background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -o-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: -ms-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
- }
- .checkedRadio {
- -moz-box-shadow: inset 0 0 5px 1px #ccc;
- -webkit-box-shadow: inset 0 0 5px 1px #ccc;
- box-shadow: inset 0 0 5px 1px #ccc;
- }
- .radio-btn i {
- border: 1px solid #E1E2E4;
- width: 10px;
- height: 10px;
- position: absolute;
- left: 4px;
- top: 4px;
- -webkit-border-radius: 100%;
- -moz-border-radius: 100%;
- border-radius: 100%;
- }
- .checkedRadio i {
- background-color: #898A8C;
- }
CSS3联系表单 背景透明迷人
这款CSS3联系表单的背景相当不错,而且是半透明的。
核心CSS代码:
- body {
- background:#2d3b36 url(Blurry-city-lights1337.jpg)no-repeat center center fixed;
- -webkit-background-size: cover;
- -moz-background-size: cover;
- -o-background-size: cover;
- background-size: cover;
- padding-top:20px;
- }
- form {
- margin-left:auto;
- margin-right:auto;
- width: 343px;
- height: 333px;
- padding:30px;
- border: 1px solid rgba(0,0,0,.2);
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- -moz-background-clip: padding;
- -webkit-background-clip: padding-box;
- background-clip: padding-box;
- background: rgba(0, 0, 0, 0.5);
- -moz-box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
- -webkit-box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
- box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
- overflow: hidden;
- }
- textarea{
- background: rgba(255, 255, 255, 0.4) url(http://luismruiz.com/img/gemicon_message.png) no-repeat scroll 16px 16px;
- width: 276px;
- height: 110px;
- border: 1px solid rgba(255,255,255,.6);
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- -moz-background-clip: padding;
- -webkit-background-clip: padding-box;
- background-clip: padding-box;
- display:block;
- font-family: 'Source Sans Pro', sans-serif;
- font-size:18px;
- color:#fff;
- padding-left:45px;
- padding-right:20px;
- padding-top:12px;
- margin-bottom:20px;
- overflow:hidden;
- }
- input {
- width: 276px;
- height: 48px;
- border: 1px solid rgba(255,255,255,.4);
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- -moz-background-clip: padding;
- -webkit-background-clip: padding-box;
- background-clip: padding-box;
- display:block;
- font-family: 'Source Sans Pro', sans-serif;
- font-size:18px;
- color:#fff;
- padding-left:20px;
- padding-right:20px;
- margin-bottom:20px;
- }
- input[type=submit] {
- cursor:pointer;
- }
- input.name {
- background: rgba(255, 255, 255, 0.4) url(http://luismruiz.com/img/gemicon_name.png) no-repeat scroll 16px 16px;
- padding-left:45px;
- }
- input.email {
- background: rgba(255, 255, 255, 0.4) url(http://luismruiz.com/img/gemicon_email.png) no-repeat scroll 16px 20px;
- padding-left:45px;
- }
- input.message {
- background: rgba(255, 255, 255, 0.4) url(http://luismruiz.com/img/gemicon_message.png) no-repeat scroll 16px 16px;
- padding-left:45px;
- }
- ::-webkit-input-placeholder {
- color: #fff;
- }
- :-moz-placeholder{
- color: #fff;
- }
- ::-moz-placeholder {
- color: #fff;
- }
- :-ms-input-placeholder {
- color: #fff;
- }
- input:focus, textarea:focus {
- background-color: rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 0 0 5px 1px rgba(255,255,255,.5);
- -webkit-box-shadow: 0 0 5px 1px rgba(255,255,255,.5);
- box-shadow: 0 0 5px 1px rgba(255,255,255,.5);
- overflow: hidden;
- }
- .btn {
- width: 138px;
- height: 44px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- float:right;
- border: 1px solid #253737;
- background: #416b68;
- background: -webkit-gradient(linear, left top, left bottom, from(#6da5a3), to(#416b68));
- background: -webkit-linear-gradient(top, #6da5a3, #416b68);
- background: -moz-linear-gradient(top, #6da5a3, #416b68);
- background: -ms-linear-gradient(top, #6da5a3, #416b68);
- background: -o-linear-gradient(top, #6da5a3, #416b68);
- background-image: -ms-linear-gradient(top, #6da5a3 0%, #416b68 100%);
- padding: 10.5px 21px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: rgba(255,255,255,0.1) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- -moz-box-shadow: rgba(255,255,255,0.1) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- box-shadow: rgba(255,255,255,0.1) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- text-shadow: #333333 0 1px 0;
- color: #e1e1e1;
- }
- .btn:hover {
- border: 1px solid #253737;
- text-shadow: #333333 0 1px 0;
- background: #416b68;
- background: -webkit-gradient(linear, left top, left bottom, from(#77b2b0), to(#416b68));
- background: -webkit-linear-gradient(top, #77b2b0, #416b68);
- background: -moz-linear-gradient(top, #77b2b0, #416b68);
- background: -ms-linear-gradient(top, #77b2b0, #416b68);
- background: -o-linear-gradient(top, #77b2b0, #416b68);
- background-image: -ms-linear-gradient(top, #77b2b0 0%, #416b68 100%);
- color: #fff;
- }
- .btn:active {
- margin-top:1px;
- text-shadow: #333333 0 -1px 0;
- border: 1px solid #253737;
- background: #6da5a3;
- background: -webkit-gradient(linear, left top, left bottom, from(#416b68), to(#416b68));
- background: -webkit-linear-gradient(top, #416b68, #609391);
- background: -moz-linear-gradient(top, #416b68, #6da5a3);
- background: -ms-linear-gradient(top, #416b68, #6da5a3);
- background: -o-linear-gradient(top, #416b68, #6da5a3);
- background-image: -ms-linear-gradient(top, #416b68 0%, #6da5a3 100%);
- color: #fff;
- -webkit-box-shadow: rgba(255,255,255,0) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- -moz-box-shadow: rgba(255,255,255,0) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- box-shadow: rgba(255,255,255,0) 0 1px 0, inset rgba(255,255,255,0.7) 0 1px 0;
- }
干货分享 超炫丽的HTML5/jQuery应用及代码的更多相关文章
- 超酷创意HTML5动画演示及代码
HTML5是未来的网页开发神器,今天分享的这些HTML5动画大部分利用了CSS3的动画属性来实现,废话不多说,直接上演示和代码. HTML5/CSS3实现大风车旋转动画 这次我们要来分享一款很酷的HT ...
- 【Bugly干货分享】一起用 HTML5 Canvas 做一个简单又骚气的粒子引擎
Bugly 技术干货系列内容主要涉及移动开发方向,是由Bugly邀请腾讯内部各位技术大咖,通过日常工作经验的总结以及感悟撰写而成,内容均属原创,转载请标明出处. 前言 好吧,说是“粒子引擎”还是大言不 ...
- 分享8款绚丽的HTML5/jQuery特效插件
有几天没有分享前端资源了,今天要向大家分享15款非常给力的HTML5/jQuery特效插件,废话少说,一起来看看. 1.CSS3图片重力感应特效 很酷的一款CSS3模拟重力感应特效,你可以拖动图片来甩 ...
- 干货分享 9款精挑细选的HTML5应用
对于前端开发者来说,分享一些优秀的HTML5应用可以直接拿来用,更重要的是可以激发创作的灵感.今天我们要分享9款精挑细选的HTML5应用,个个都是干货. 1.HTML5/CSS3滑块动画菜单 图标动画 ...
- 分享一组很赞的 jQuery 特效【附源码下载】
作为最优秀的 JavaScript 库之一,jQuery 不仅使用简单灵活,同时还有许多成熟的插件可供选择,它可以帮助你在项目中加入漂亮的效果.这篇文章挑选了8个优秀的 jQuery 实例教程,这些 ...
- 简直要逆天!超炫的 HTML5 粒子效果进度条
我喜欢粒子效果作品,特别是那些能够应用于实际的,例如这个由 Jack Rugile 基于 HTML5 Cavnas 编写的进度条效果.看着这么炫的 Loading 效果,即使让我多等一会也无妨:)你呢 ...
- 【干货分享】Node.js 中文资料导航
这篇文章与大家分享一批高质量的的 Node.js 中文资料.Node.js 是一个基于 Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的, 易于扩展的网络应用 Node ...
- 7款经典炫酷的HTML5/jQuery动画应用示例及源码
jQuery是一款普遍受前端开发者欢迎的Javascript框架,但是开发者貌似更关注jQuery开发的插件,海量的jQuery插件让前端开发者非常方便.HTML5的加入让jQuery这个家族更加丰富 ...
- 分享8款精美的jQuery图片播放插件
本文将和大家一起分享8款精美的jQuery图片播放插件,每一款插件均有演示和源码下载,有兴趣的朋友可以下载使用和研究.废话不多说了,直接上这些插件. 1.3D轮播相册 这款3D相册插件利用了HTML5 ...
随机推荐
- 怎样把任意exe程序注册成windows系统服务(手动注册服务)
1. 要实现这个功能要用到微软提供的两个小工具“instsrv.exe”和“srvany.exe”(下载地址:http://www.cr173.com/soft/64394.html). 先下载这两个 ...
- LeetCode: Search a 2D Matrix 解题报告
Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This m ...
- scikit-learn学习之贝叶斯分类算法
版权声明:<—— 用心写好你的每一篇文章,转载请注明出处@http://blog.csdn.net/gamer_gyt <—— 目录(?)[+] ================= ...
- C#学习笔记(28)——匿名委托和Lambda表达式
说明(2017-11-21 18:51:32): 1. 例子为求1~100的和,答案应该是5050(小学学算盘的时候,我爹就让我算,从1拨到100是多少呀?当时的我年幼无知,还不知道高斯小时候的故事, ...
- 基于jQuery悬停图片变色放大特效
分享一款基于jQuery悬停图片变色放大特效是一款响应式鼠标悬停图片放大效果代码.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div style="width ...
- IIS时间格式设置
IIS时间格式调整: (已解决)今天在用IIS7的时候发现一个关于时间格式的问题,当我在ASP中使用now()时间函数的时候,日期是以“/”来分隔,而不是以“-”来分隔的,使得我在运行程序的时候老出错 ...
- JAVA字符串怎么转换成整数
首先你要确定你的字符串可以转换为int类型的,比如说: String s = "123"; 如果String s = "abc";则转换时会报错! 需要的包是& ...
- 主流HTML5游戏框架的分析和对比
本文主要选取了Construct2.ImactJS.LimeJS.GameMaker.CreateJS.lycheeJS.Crafty.three.js.melonJS.Turbulenz.Quint ...
- Java IO流学习
Java IO流学习 Java流操作有关的类或接口: Java流类图结构: 流的概念和作用 流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称或抽象.即数据在两设备间的传输称为流,流的本质是 ...
- vba的一个DB操作类
Option Explicit '-------------------------------------------------------- '[Class Name]: DBHelper '[ ...