[html] How to increase space between dotted border dots

This trick works for both horizontal and vertical borders:

/*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;

You can adjust the size with background-size and the proportion with the linear-gradient percentages. In this example I have a dotted line of 1px dots and 2px spacing. This way you can have multiple dotted borders too using multiple backgrounds.

Try it in this JSFiddle or take a look at the code snippet example:

_x000D_
_x000D_
div {_x000D_
  padding: 10px 50px;_x000D_
}_x000D_
.dotted {_x000D_
  border-top: 1px #333 dotted;_x000D_
}_x000D_
.dotted-gradient {_x000D_
  background-image: linear-gradient(to right, #333 40%, rgba(255, 255, 255, 0) 20%);_x000D_
  background-position: top;_x000D_
  background-size: 3px 1px;_x000D_
  background-repeat: repeat-x;_x000D_
}_x000D_
.dotted-spaced {_x000D_
  background-image: linear-gradient(to right, #333 10%, rgba(255, 255, 255, 0) 0%);_x000D_
  background-position: top;_x000D_
  background-size: 10px 1px;_x000D_
  background-repeat: repeat-x;_x000D_
}_x000D_
.left {_x000D_
  float: left;_x000D_
  padding: 40px 10px;_x000D_
  background-color: #F0F0DA;_x000D_
}_x000D_
.left.dotted {_x000D_
  border-left: 1px #333 dotted;_x000D_
  border-top: none;_x000D_
}_x000D_
.left.dotted-gradient {_x000D_
  background-image: linear-gradient(to bottom, #333 40%, rgba(255, 255, 255, 0) 20%);_x000D_
  background-position: left;_x000D_
  background-size: 1px 3px;_x000D_
  background-repeat: repeat-y;_x000D_
}_x000D_
.left.dotted-spaced {_x000D_
  background-image: linear-gradient(to bottom, #333 10%, rgba(255, 255, 255, 0) 0%);_x000D_
  background-position: left;_x000D_
  background-size: 1px 10px;_x000D_
  background-repeat: repeat-y;_x000D_
}
_x000D_
<div>no_x000D_
  <br>border</div>_x000D_
<div class='dotted'>dotted_x000D_
  <br>border</div>_x000D_
<div class='dotted-gradient'>dotted_x000D_
  <br>with gradient</div>_x000D_
<div class='dotted-spaced'>dotted_x000D_
  <br>spaced</div>_x000D_
_x000D_
<div class='left'>no_x000D_
  <br>border</div>_x000D_
<div class='dotted left'>dotted_x000D_
  <br>border</div>_x000D_
<div class='dotted-gradient left'>dotted_x000D_
  <br>with gradient</div>_x000D_
<div class='dotted-spaced left'>dotted_x000D_
  <br>spaced</div>
_x000D_
_x000D_
_x000D_

Examples related to html

Embed ruby within URL : Middleman Blog Please help me convert this script to a simple image slider Generating a list of pages (not posts) without the index file Why there is this "clear" class before footer? Is it possible to change the content HTML5 alert messages? Getting all files in directory with ajax DevTools failed to load SourceMap: Could not load content for chrome-extension How to set width of mat-table column in angular? How to open a link in new tab using angular? ERROR Error: Uncaught (in promise), Cannot match any routes. URL Segment

Examples related to css

need to add a class to an element Using Lato fonts in my css (@font-face) Please help me convert this script to a simple image slider Why there is this "clear" class before footer? How to set width of mat-table column in angular? Center content vertically on Vuetify bootstrap 4 file input doesn't show the file name Bootstrap 4: responsive sidebar menu to top navbar Stylesheet not loaded because of MIME-type Force flex item to span full row width

Examples related to border

How to create a inner border for a box in html? Android LinearLayout : Add border with shadow around a LinearLayout Giving a border to an HTML table row, <tr> In bootstrap how to add borders to rows without adding up? Double border with different color How to make a transparent border using CSS? How to add a border just on the top side of a UIView Remove all stylings (border, glow) from textarea How can I set a css border on one side only? Change input text border color without changing its height