How to create dotted border with round dots in WebKit browsers?

后端 未结 3 625
无人及你
无人及你 2021-02-05 15:50

In WebKit driven browsers, e.g. Safari, Chrome, borders with their style declared as dotted are rendered with square dots instead of round.

Is there any way

3条回答
  •  半阙折子戏
    2021-02-05 16:24

    A natively supported solution is currently lacking, as the specification does not define these properties explicitly, and leaves it for the browser's implementation.

    You may, however, use SVG to create the border, as it offers full control over the characteristics you're after.

    Draw a line, than define its stroke-dasharray and stroke-linecap attributes to achieve the desired effect.

    Example Code Snippet

    
    

    Result Snapshot

    SVG dotted round border

    Demo

    • http://jsfiddle.net/eliranmal/hsfxS/

    References (on Mozilla Developer Network)

    • stroke-dasharray
    • stroke-linecap

提交回复
热议问题