codecamp

定位和过度

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .box{ width: 400px; height: 200px; background: red; position: relative; overflow: hidden; } .k2{ width: 280px; height: 160px; background:yellow; position: absolute; left: 20%; top: 10%; transition: 1s; } .box:hover .k2{ left: 10%; top: 10%; width: 200px; height: 100px; background: chartreuse; } .box span:nth-of-type(1){
width: 80px; height: 50px; background: cyan;
transition: 1s; position: absolute;
left: 400px; top: 0px;
} .box:hover span:nth-of-type(1){ width: 80px; height: 50px; background: chocolate;
left: 320px; top: 20px; } .box span:nth-of-type(2){
width: 80px; height: 50px; background: cyan;
transition: 1s 0.5s; position: absolute;
left: 400px; top: 100px;
} .box:hover span:nth-of-type(2){ width: 80px; height: 50px; background: chocolate;
left: 320px; top: 120px; } </style> </head> <body> <div class="box"> <div class="k2"></div> <span></span> <span></span> <span></span> </div> </body> </html>

2D,3D
JS
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }