Search code examples
htmlcsssassoutline

How to set radius for outline


I want to use border and outline on my element with some radius.

border-radius is only working for border.

Is there any way to apply radius on outline too?

.myElement {
    border: 2px solid #0064D2;
    outline: 2px solid #0099F8;
    border-radius: 3px;
}

enter image description here


Solution

  • Not currently, though I believe it's planned, but you can simulate it with a box-shadow instead.

    .myElement {
      border: 2px solid #0064D2;
      border-radius: 3px;
      box-shadow: 0 0 0 2px #0099f8;
    }
    <div class="myElement">
      Hello World
    </div>