<style> div{ width: 420px; height: 200px; background: url('./img/timg.jpg') no-repeat; } polyline{ stroke: #3366cc; /* 線段顏色 */ stroke-width: 4; /* 線段寬度 */ fill: none; /* 描繪不填充 */ stroke-dasharray: 1160px; /* 線段總長度 */ stroke-dashoffset: 1160px; /* 線段未繪製的長度 */ transition: .8s; } div:hover polyline{ stroke-dashoffset: 0px; } </style> </head> <body> <div class="svgTest"> <svg width="420" height="200"> <polyline points="10,10 410,10 410,190 10,190 10,10"></polyline> <!-- 繪製路徑的四個點 --> </svg> </div>