Search code examples
cssbordercss-shapes

Control the dashed border stroke length and distance between strokes


Is it possible to control the length and distance between dashed border strokes in CSS?

This example below displays differently between browsers:

div {
  border: dashed 4px #000;
  padding: 20px;
  display: inline-block;
}
<div>I have a dashed border!</div>

Big differences: IE 11 / Firefox / Chrome

IE 11 borderFirefox BorderChrome border

Are there any methods that can provide greater control of the dashed borders appearance?


Solution

  • Css render is browser specific and I don't know any fine tuning on it, you should work with images as recommended by Ham. Reference: http://www.w3.org/TR/CSS2/box.html#border-style-properties