0

How would I go about making this in CSS3/HTML5?

The Red background is the background of the div. The inner white is another div that will contain some text.

Border

PiotrG
  • 743
  • 6
  • 24

1 Answers1

2

Since you already have 2 containers, you can use two pairs of pseudo elements for the corners, like this:

.outer {
  width: 120px;
  background: #a08;
  position: relative;
  padding: 30px;
}

.inner {
  height: 118px;
  background: #fff;
  border: 1px dashed #a08;
  flex: 1;
}

.outer::before, .outer::after, .inner::before, .inner::after {
  content: '';
  width: 20px;
  height: 20px;
  background: #a08;
  background-clip: padding-box;
  border: 1px dashed #a08;
  border-radius: 50%;
  position: absolute;
  z-index: 1;
}
.outer::before {
  top: 20px;
  left: 20px;
}
.outer::after {
  top: 20px;
  right: 20px;
}
.inner::before {
  bottom: 20px;
  left: 20px;
}
.inner::after {
  bottom: 20px;
  right: 20px;
}
<div class="outer">
  <div class="inner"></div>
</div>
Ilya Streltsyn
  • 13,076
  • 2
  • 37
  • 57