自定义 border(dashed)虚线的间距 效果展示
代码展示
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8" /> <title>document</title> <style> body{ background: #000; display: flex; align-items: center; justify-content: center; } div{ margin-top: 100px; width: 300px; height: 2px; background: linear-gradient(to right, transparent 0%, transparent 50%,#CCC 50%,#CCC 100%); background-size: 15px 1px; background-repeat: repeat-x; } </style> </head> <body> <div></div> </body> </html>