Result
2色や3色など、色とりどりな点線をlinear-gradientで引いています
css
.block {/*基本設定*/ background-color: #FFF; height: 20px; margin-bottom: 20px; position: relative; } .block:before { bottom: 0; content: ''; height: 10px; position: absolute; width: 100%; } .block-one:before {/*疑似要素に複数グラデーションを設定していく*/ background-size: 60px 100%; background-color: #ccc69a; background-image: linear-gradient(left, transparent 0%, transparent 25%, #89a193 25%, #89a193 50%, transparent 50%, transparent 75%, #cc8734 75%, #cc8734 100%); } .block-two:before { background-size: 30px 100%; background-color: #e8e6d6; background-image: linear-gradient(left, transparent 0%, transparent 25%, #655f6a 25%, #655f6a 50%, transparent 50%, transparent 75%, #bb7761 75%, #bb7761 100%); } .block-three:before { background-size: 10px 100%; background-color: #d7b2b5; background-image: linear-gradient(left, transparent 0%, transparent 50%, #bb7761 50%, #bb7761 100%); } .block-four:before { background-size: 120px 100%; background-color: #ccc69a; background-image: linear-gradient(left, transparent 0%, transparent 25%, #737258 25%, #737258 50%, transparent 50%, transparent 75%, #bb7761 75%, #bb7761 100%); } .block-five:before { background-size: 120px 100%; background-color: #655f6a; background-image: linear-gradient(left, transparent 0%, transparent 50%, #e8e6d6 50%, #e8e6d6 100%); }
html
<div class="container"> <div class="block block-one"></div> <div class="block block-two"></div> <div class="block block-three"></div> <div class="block block-four"></div> <div class="block block-five"></div> </div>