0

I have a box-shaped hole in the center of a div.

The dark background is from the line below

outline: 9999px solid rgba(0, 0, 0, 0.8);

However, my outline does not wrap around the rounded corners of my box from

border-radius: 12px;

How do I wrap my dark background around my box so the sharp corners in the hole don't show?

div {
  width: 500px;
  height: 500px;
  background: red;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -250px;
  margin-left: -250px;
  border-radius: 12px;
  outline: 9999px solid rgba(0, 0, 0, 0.8);
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="index.css" />
    <title>Static Template</title>
  </head>
  <body>
    <div></div>
  </body>
</html>
dev_el
  • 1,308
  • 2
  • 10
  • 34

0 Answers0