效果图:
代码如下:
<!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>【JQuery插件】扑克正反面翻牌效果</title> <style> *{margin:0px;padding:0px;list-style:none;font-size: 16px;} </style> </head> <body> <style> .demo1 {margin:10px; width: 200px;height: 100px;text-align: center;position: relative;} .demo1 .front{width: 200px;height: 100px;position:absolute;left:0px;top:0px;background-color: #000;color: #fff;} .demo1 .behind{width: 200px;height: 0px;position:absolute;left:0px;top:50px;background-color: #ccc;color: #000;display: none;} </style> <h1>demo1 y轴 (css布局提示:背面默认隐藏 height为0 top是高度的一半也就是demo中间)</h1> <div class="demo1"> <div class="front">正面正面正<br/>面正面正面<br/></div> <div class="behind">背面</div> </div> <div class="demo1"> <div class="front">正面</div> <div class="behind">背面</div> </div> <style> .demo2 {margin:10px; width: 200px;height: 100px;text-align: center;position: relative;} .demo2 .front{width: 200px;z-index: 1; height: 100px;position:absolute;left:0px;top:0px;background-color: #000;color: #fff;} .demo2 .behind{width: 0;height: 100px;z-index: 0;position:absolute;left:100px;top:0;background-color: #ccc;color: #000;} </style> <h1>demo2 x轴(css布局提示:背面默认隐藏 width为0 left是宽度的一半也就是demo中间)</h1> <div class="demo2"> <div class="front">正面</div> <div class="behind">背面</div> </div> <div class="demo2"> <div class="front">正面</div> <div class="behind">背面</div> </div> <script type="text/javascript" src="/UploadFiles/2021-04-02/jquery144p.js">以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!