JSFiddle - React, Tailwind, and code Playground

by Vladimir Kutepov

HTML

some content

<div class="modal">
  <div class="content">
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    Modal<br />
    <button class="button" type="button">x</button>
  </div>
</div>

CSS

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 0;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.content {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: 50%;
  margin: 0 auto;
}
.button {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  padding: 5px 10px;
  border: 0;
  background: none;
}