<div class="header">
  <h1>Pure CSS Modal Dialog with sliding content</h1>
  <label for="mpo-modal-controller" class="btn">open modal</label>
</div>

<div class="mpo-modal">
  <input type="checkbox" id="mpo-modal-controller" class="mpo-modal-open" hidden>
  <div class="mpo-modal-wrap">
    <label for="mpo-modal-controller" class="mpo-modal-overlay"></label>
    <div class="mpo-modal-body">

      <label for="mpo-modal-controller" class="mpo-modal-close">&times;</label>

      <input type="radio" name="content-nav" id="modal-content-1" class="modal-radio" checked hidden/>
      <input type="radio" name="content-nav" id="modal-content-2" class="modal-radio" hidden/>
      <input type="radio" name="content-nav" id="modal-content-3" class="modal-radio" hidden/>

      <div class="mpo-modal-slide content-1">
        <div class="mpo-modal-content">
          <h2>Example Modal - Slide 1</h2>
          <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
            in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          </p>

          <div class="mpo-modal-nav">
            <label for="modal-content-2" class="next-slide">&#8250;&#8250;</label>
          </div>
        </div>
      </div>

      <div class="mpo-modal-slide content-2">
        <div class="mpo-modal-content">
          <h2>Example Modal - Slide 2</h2>
          <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
            in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          </p>

          <div class="mpo-modal-nav">
            <label for="modal-content-1" class="prev-slide">&#8249;&#8249;</label>
            <label for="modal-content-3" class="next-slide">&#8250;&#8250;</label>
          </div>
        </div>
      </div>

      <div class="mpo-modal-slide content-3">
        <div class="mpo-modal-content">
          <h2>Example Modal - Slide 3</h2>
          <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
            in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          </p>

          <div class="mpo-modal-nav">
            <label for="modal-content-2" class="prev-slide">&#8249;&#8249;</a>
          </div>
        </div>
      </div>

    </div>
  </div>

</div>
*,
*:before,
*:after {
  box-sizing: border-box;
}

html,
body {
  color: #222;
  height: 100%;
  font-family: georgia, sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

.header{
  margin: 30px;
  text-align: center;
}
/* modal open|close controller */
#mpo-modal-controller {
  position: absolute;
  left: -999em;
  opacity: 0;
}
.mpo-modal-open:checked ~ .mpo-modal-wrap {
  display: block;
  
  &:before, .mpo-modal-overlay {
    display: block;
  }
}
.mpo-modal-close {
  cursor: pointer;
  font-size: 35px;
  font-weight: bold;
  line-height: 20px;
  padding: 10px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 100;
}


/* modal */
.mpo-modal-wrap {
  display: none;
  
  &:before {
    content: "";
    display: none;
    background: rgba(0, 0, 0, .8);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 101;
  }
}

.mpo-modal-overlay {
  bottom: 0;
  display: none;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 102;
}

.mpo-modal-body {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  max-height: 90%;
  padding: 15px 0;
  background: #fff;
  border-radius: .25em;
  overflow: hidden;
  text-align: center;
  width: 75%;
  z-index: 103;
  
  p {
    text-align: left;
    line-height: 1.3;
  }
}

.mpo-modal-content {
  margin: 30px 15px 50px;
  padding: 50px 0 0;
  position: relative;
}

.mpo-modal-slide {
  display: flex;
  position: absolute;
  transition:  all 0.4s ease-in;
  width: 100%
}

.modal-content-1 {
}

.modal-content-2 {
  left: 100%;
}

.modal-content-3 {
  left: 200%;
}

#modal-content-1:checked ~ .content-1 {
  left: 0;
  overflow: auto;
  position: relative;
}
#modal-content-1:checked ~ .content-2 {
  left: 100%;
}

#modal-content-2:checked ~ .content-1 {
  left: -100%;
}

#modal-content-2:checked ~ .content-2 {
  left: 0;
  overflow: auto;
  position: relative;
}

#modal-content-2:checked ~ .content-3 {
  left: 100%;
}

#modal-content-3:checked ~ .content-1 {
  left: -200%;
}

#modal-content-3:checked ~ .content-2 {
  left: -100%;
}

#modal-content-3:checked ~ .content-3 {
  left: 0;
  overflow: auto;
  position: relative;
}

.mpo-modal-nav {
  position: absolute;
  top: 50px;
  width: 100%;
  
  label {
    position: absolute;
    background: #f7f7f7;
    color: #303030;
    cursor: pointer;
    display: inline-block;
    font: 50px Arial;
    line-height: 45px;
    height: 50px;
    width: 80px;
    padding: 0 30px 0 25px;
    text-decoration: none;
    vertical-align: middle;
    letter-spacing: -7px;
    text-align: center;
    
    &.prev-slide {
      content: '';
      left: 0;
    }
    &.next-slide {
      content: '';
      right: 0;
    }
  }
  
}

.btn {
  background: #fff;
  border: #555 solid 1px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-block;
  font-size: 14px;
  padding: 8px 15px;
  text-decoration: none;
  text-align: center;
  min-width: 60px;
  position: relative;
}

@media only screen and (max-width: 767px) {
  .mpo-modal-body {
    max-width: 100%;
    width: 100%;
    border-radius: 0;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.