<div class="demo demo-1"></div>
<div class="demo demo-2"></div>
.demo {
  width: 100px;
  height: 100px;
  float: left;
}
.demo-1 {
  background: pink;
  outline: 10px dashed red;
  outline-offset: -20px;
}
.demo-2 {
  background: black;
  outline: 20px dotted white;
  outline-offset: -20px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js