JSFiddle - React, Tailwind, and code Playground

by Danielo Rodriguez

HTML

<div>
Just some basic text
</div>
<div class="main">
  <div class="background"></div>
  <div class="content">Content</div>
  <div class="norelative">No relative</div>
</div>

CSS

.main {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.background {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(100, 0, 0, 0.55);
}

.content {
  background-color: lightblue;
  padding: 1rem;
  position: relative;
}

.norelative {
  background-color: lightblue;
  padding: 1rem
}