CSSで点線・破線の間隔を調整する方法

cssで間隔を調整出来る点線や破線の再現方法をご紹介します。
cssのborderでは点線や破線の間隔を調整出来ない
cssのborderを使用して、点線や破線を引くことが出来ますが、
この方法では点線、破線の間隔を調整することができません。
| 
					 1 2 3 4 5 6 7 8 9  | 
						/* 点線 */ .dotted { 	border-bottom: 2px dotted #000000; } /* 破線 */ .dashed { 	border-bottom: 2px dashed #000000; }  | 
					

cssのbackgroundを使用して点線、波線を再現
点線や破線の間隔を調整するには、borderではなくbackgroundを使用します。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | 
						/* 点線 */ .dotted { 	background-image: linear-gradient(to right, #000, #000 2px, transparent 2px); 	background-size: 10px 2px /* 幅・高さを指定 */; 	background-position: left bottom /* 背景の開始位置を指定 */; 	background-repeat: repeat-x /* 横方向にのみリピート */; } /* 破線 */ .dashed { 	background-image: linear-gradient(to right, #000, #000 5px, transparent 5px); 	background-size: 15px 2px /* 幅・高さを指定 */; 	background-position: left bottom /* 背景の開始位置を指定 */; 	background-repeat: repeat-x /* 横方向にのみリピート */; }  | 
					


![MARKLEAPS[マークリープス]](https://markleaps.com/blog/wp-content/themes/mkl/images/00_logo.png)


![[CSS] shape-outside プロパティで画像にテキストを回り込ませる方法](https://markleaps.com/blog/wp-content/uploads/2025/09/css-shape-outside-500x254.jpg)
![[HTML・CSS] 説明リストdlのdtとddを横並びに表示する方法(コピペで使えるコード付き)](https://markleaps.com/blog/wp-content/uploads/2025/09/html-css-dl-flex-grid-500x254.jpg)
![[CSS] 疑似クラス  is()  とwhere() の使い方と違い](https://markleaps.com/blog/wp-content/uploads/2023/11/css-is-where-500x254.jpg)