上からフェードでポップアップ表示

DEMO

HTMLとCSSをまとめてコピーする

HTML

		<div class="popup">
  <input id="trigger1" type="checkbox">
  <div class="popup_overlay">
    <label for="trigger1" class="popup_trigger"></label>
    <div class="popup_content">
      <label for="trigger1" class="close_button">×</label>
      <p class="popup_title">タイトル1</p>
      <span>ああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ</span> </div>
  </div>
</div>
<div class="popup">
  <input id="trigger2" type="checkbox">
  <div class="popup_overlay">
    <label for="trigger2" class="popup_trigger"></label>
    <div class="popup_content">
      <label for="trigger2" class="close_button">×</label>
      <p class="popup_title">タイトル2</p>
      <span>いいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいい</span> </div>
  </div>
</div>
<div class="popup">
  <input id="trigger3" type="checkbox">
  <div class="popup_overlay">
    <label for="trigger3" class="popup_trigger"></label>
    <div class="popup_content">
      <label for="trigger3" class="close_button">×</label>
      <p class="popup_title">タイトル3</p>
      <span>ううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううううう</span> </div>
  </div>
</div>
<center>
  <label for="trigger1" class="open_button">タイトル1</label>
  <label for="trigger2" class="open_button">タイトル2</label>
  <label for="trigger3" class="open_button">タイトル3</label>
</center>

		
HTMLをコピーする

HTML説明

ポップアップの増減方法
<div class="popup">~</div>(1~10.11~20.21~30行目など)までの記述が1つのポップアップの要素です。
<label for="trigger1" class="open_button">タイトル●</label>が1つのボタンの要素です。
それぞれ増やす場合は複製をしてください。
またその際「trigger●」となっている部分は数値を入れてください。(4つめなら「4」など)
減らす場合は上記の範囲を両方削除してください。

CSS

		<style>
.popup input {
  display: none;
}
.popup_overlay {
  display: flex;
  justify-content: center;
  overflow: auto;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.5s, transform 0s 0.5s;
  transform: scale(0);
}
.popup_trigger {
  position: absolute;
  width: 100%;
  height: 100%;
}
.popup_content {
  align-self: center;
  padding: 2em;
  box-sizing: border-box;
  transition: 0.5s;
  text-align: center;
  background: #FFF;
  width: 85%;
  max-width: 580px;
  font-weight: .9em;
}
.popup_content p {
  padding-top: 0;
  color: #4f96f6;
  border-bottom: solid 3px #4f96f6;
  margin-bottom: 15px;
  font-weight: bold;
}
.close_button {
  position: absolute;
  right: -25px;
  font-size: 24px;
  cursor: pointer;
  color: #ffffff;
  top: -30px;
}
.popup input:checked ~ .popup_overlay {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.5s;
}
.popup input:checked ~ .popup_overlay .popup_content {
  transform: translateY(20px);
}
.open_button {
  color: #FFF;
  background-color: #9da5b1;
  font-weight: bold;
  text-align: center;
  cursor :pointer;
  transition: all 0.3s;
  display: block;
  padding: 12px;
  text-decoration: none;
  margin: 3px auto;
  border-radius: 5px;
  max-width: 580px;
}
.open-button:active {
  -webkit-transform: translateY(2px);
  transform: translateY(2px);/*下に動く*/

}
.open-button:after {
  font-family: "Font Awesome 5 Free";
  content: "\f2d0";
  padding-left: 8px;
}
.open-button:hover {
  color: #FFFFFF;
  background-color: #4f96f6;
  transition: .6s;
}
.popup_title {
  font-size: 1.5em;
	position: relative;
	overflow: hidden;
  padding-bottom: 10px;
  margin-top:0;
  margin-bottom: 0;
}
</style>
		
cssをコピーする

CSS説明

色の変更方法
各色コードを任意のものに書き換えてください。
ボタンの文字色=60行目
ボタンの色=61行目
ポップアップのタイトル文字色=38行目
ポップアップのタイトル文字の下線=39行目