Home >Web Front-end >CSS Tutorial >How Can I Control the Spacing of Dots in Dotted CSS Borders?
Controlling Dot Spacing in Dotted Borders
To increase the space between dots in a dotted border, consider using a gradient technique. This method applies to both horizontal and vertical borders.
Horizontal Borders:
Vertical Borders:
Example Code:
/* Horizontal */ background-image: linear-gradient(to right, black 33%, rgba(255,255,255,0) 0%); background-position: bottom; background-size: 3px 1px; background-repeat: repeat-x; /* Vertical */ background-image: linear-gradient(black 33%, rgba(255,255,255,0) 0%); background-position: right; background-size: 1px 3px; background-repeat: repeat-y;
By adjusting the percentages in the linear gradient, you can control the ratio of dots to spacing. The background-size property determines the dot size.
Note: This technique allows for multiple dotted borders by utilizing multiple background images.
The above is the detailed content of How Can I Control the Spacing of Dots in Dotted CSS Borders?. For more information, please follow other related articles on the PHP Chinese website!