实现原理
若是div,则使用动感的斜纹图片作为背景,内部div有1px的margin,并且其高度比外部div少2px即可
若是图片,则只需指定动感的斜纹图片为背景即可
动态斜纹图片地址 http://www.zhangxinxu.com/study/image/selection.gif
完整范例代码
<template> <div style="padding: 20px"> <div class="selection box"> <div class="contentBox"></div> </div> <img class="selection" src="https://ucc.alicdn.com/images/user-upload-01/img_convert/1c71589b514c81fc942cacaf0ad0cb96.png" width="500" height="140"> </div> </template> <style scoped> .selection { background-image: url(http://www.zhangxinxu.com/study/image/selection.gif); } .box { width: 200px; height: 100px; overflow: hidden; } .contentBox { margin: 1px; height: 98px; background: #14b678; } </style>