@charset "utf-8"; /* CSS reset */ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td,figure,figcaption { margin:0; padding:0; } html,body { margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset,img { border:0; } address,caption,cite,code,dfn,th,var { font-style:normal; font-weight:normal; } ol,ul,li { list-style:none; } caption,th { text-align:left; } h1,h2,h3,h4,h5,h6 { font-size:100%; font-weight:normal; } q:before,q:after { content:''; } abbr,acronym { border:0; } .red { background:rgb(230,0,0); padding:10px 60px; height:100px; line-height:100px } .red .warp { width:900px; margin:0 auto; } .red .warp .title { width:19.5%; display:inline-block; text-align:center; color:#ccc; font-size:20px } .red .warp .title .titles { transform-origin:top center; display:inline-block; height:40px; line-height:40px; padding:0 10px; background:red; position:relative; transform-style:preserve-3d; transition:transform 0.5s; } .red .warp .title .titles::before { content:attr( data-state); position:absolute; left:0; top:100%; height:100%; padding:0 10px; background:red; transform-origin:top center; transform:rotateX(-90deg); } .red .warp .title .titles:hover { transform:rotateX(90deg); } .blue { background:rgb(0,0,180); padding:10px 30px; } .blue .warp { width:900px; margin:0 auto; height:100px; line-height:100px; } .blue .warp .title { margin-top:40px; height:30px; line-height:30px; width:19.5%; display:inline-block; text-align:center; color:#fff; font-size:20px; overflow:hidden; } .blue .warp .title .titles { display:inline-block; position:relative; transition:transform 0.5s; transform-style:preserve-3d; } .blue .warp .title .titles::before { content:attr( data-state); position:absolute; font-weight:bolder; top:100% } .blue .warp .title .titles:hover { transform:translateY(-100%); } .two { background:blue; padding:10px 30px; height:100px; line-height:100px; } .two .warp { width:900px; margin:0 auto; } .two .warp .title { width:19.5%; display:inline-block; text-align:center; color:#fff; font-size:20px } .two .warp .title .titles { transform-origin:left center; display:inline-block; height:40px; line-height:40px; padding:0 10px; background:rgb(0,0,240); position:relative; transform-style:preserve-3d; transition:transform 0.5s; } .two .warp .title .titles::before { content:attr( data-state); position:absolute; left:100%; top:0; height:100%; padding:0 10px; background:rgb(0,0,200); transform-origin:left center; transform:rotateY(90deg); } .two .warp .title .titles:hover { transform:rotateY(-90deg); } .tree { background:rgb(180,180,180); padding:10px 30px; height:100px; line-height:100px; } .tree .warp { width:100%; margin:0 auto; text-align:center; } .tree .warp .title { margin-right:15px; margin-left:15px; margin-top:30px; height:40px; line-height:40px; position:relative; transform-style:preserve-3d; display:inline-block; text-align:center; font-size:20px; perspective:1000px } .tree .warp .title .titles { display:inline-block; transition:background 0.5s; display:inline-block; padding:0 10px; background:#ccc; color:#fff; border-top:2px solid #000; } .tree .warp .title .titles::before { content:attr( data-state); transition:transform 1s,opacity 1s; transform-origin:top center; transform:rotateX(-0deg); position:absolute; left:0; top:0; height:100%; padding:0 10px; background:#fff; color:#000; opacity:0; border-top:2px solid #fff; } .tree .warp .title:hover .titles { background:#000; } .tree .warp .title:hover .titles::before { transform:rotateX(-360deg); opacity:1 } .one { background:rgb(100,95,95); padding:10px 30px; height:100px; line-height:100px; } .one .warp { width:100%; margin:0 auto; text-align:center; } .one .warp .title { margin-left:30px; width:170px; text-align:center; font-size:20px; display:inline-block; position:relative; transform-style:preserve-3d; perspective:1000px; } .one .warp .title .titles { display:inline-block; color:#b5b5b5; } .one .warp .title .titles::before { content:attr( data-state); display:inline-block; position:absolute; color:#fff; width:170px; transform-origin:100% 0; transform:scale(1.1) translateX(10px) translateY(-10px) rotate(4deg); left:0; opacity:0; transition:all 0.5s linear; } .one .warp .title:hover .titles::before { transform:scale(1) translateX(0px) translateY(0px) rotate(0deg); opacity:1; }
data-state="" 里面的内容是鼠标经过后的内容