Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<div class="choose_box">
  
<div id="q_01" class="fit">
 <p>質問1</p>
<ul class="flexbox fw">
<li class="even"><a class="btn" href="#q_02">選択肢1</a></li>
<li class="odd"><a class="btn" href="#q_03">選択肢2</a></li>
<li class="odd"><a class="btn" href="#q_04">選択肢3</a></li>
<li class="odd"><a class="btn" href="#q_05">選択肢4</a></li>
</ul>
 </div>
 <!-- 最初の選択肢 -->
  
<div id="q_02" style="display: none;">
<p>質問2?</p>
<ul class="flexbox fw">
<li class="even"><a class="btn" href="#q_06">選択肢1-1</a></li>
<li class="odd"><a class="btn" href="#q_07">選択肢1-2</a></li>
</ul>
</div>
<!-- 次の選択肢 --> 
 
<div id="q_03" style="display: none;">
<p>質問2?</p>
<ul class="flexbox fw">
<li class="even"><a class="btn" href="#q_06">選択肢2-1</a></li>
<li class="odd"><a class="btn" href="#q_07">選択肢2-2</a></li>
</ul>
</div>
<!-- 次の選択肢 --> 
  
<div id="q_04" style="display: none;">
<p>質問2?</p>
<ul class="flexbox fw">
<li class="even"><a class="btn" href="#q_06">選択肢3-1</a></li>
<li class="odd"><a class="btn" href="#q_07">選択肢3-2</a></li>
</ul>
</div>
<!-- 次の選択肢 --> 
  
 <div id="q_05" style="display: none;">
<p>質問2?</p>
<ul class="flexbox fw">
<li class="even"><a class="btn" href="#q_06">選択肢4-1</a></li>
<li class="odd"><a class="btn" href="#q_07">選択肢4-2</a></li>
</ul>
</div>
<!-- 次の選択肢 -->
  
  
 <div id="q_06" style="display: none;">
        <p>あなたにおすすめなのは…</p>
        <h4>『答え①』です!!</h4>
   <span><a class="btn" href="#q_01">もどる</a></span>
</div>
 
<!-- 選択肢の答え① -->
  
  <div id="q_07" style="display: none;">
        <p>あなたにおすすめなのは…</p>
        <h4>『答え②』です!!</h4>
     <span><a class="btn" href="#q_01">もどる</a></span>
</div>
 
<!-- 選択肢の答え② -->
</div>
              
            
!

CSS

              
                body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Yu Gothic", YuGothic, sans-serif;
}

.choose_box {
  position: relative;
  height: 50vw;
  width: 100%;
}
 .choose_box p {
    font-size: 24px;
    display: block;
    font-weight: 600;
    text-align: center;
  }

.choose_box ul {
    width: 80%;
    text-align: center;
    margin: auto;
   display:flex;
  flex-wrap: wrap;
}
.choose_box ul li {
  width: calc(100% / 2 - 20px);
  margin-right: 20px;
  margin-bottom: 20px;
  list-style: none;
}

.choose_box ul li:nth-child(2n) {
   margin-right: 0;
}
.choose_box ul li a {
  color: #fff;
  display: block;
  padding: 20px 60px;
  text-align: center;
  background-color: #2791d4;
  font-weight: 600;
  font-size: 18px;
  border: 2px solid #2791d4;
  text-decoration: none;
  -webkit-border-radius: 6px;
  -moz-border-radius: 6px;
  border-radius: 6px;
}

.choose_box ul li a:hover {
   background-color: #fff;
  color: #2791d4;
    -webkit-transition: 0.7s;
    -moz-transition: 0.7s;
    -o-transition: 0.7s;
    transition: 0.7s;
}

h4 {
    width: 50%;
    clear: both;
    margin: auto;
    padding: 20px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    text-align: center;
  background-color: #C00003;
  }

.fit {
  position: absolute;
  left: 0px;
  top: 20px;
  width: 100%;
}
#q_06 span,#q_07 span {
  display: block;
  width:100%;
}
#q_06 a,#q_07 a {
  display: block;
  width:100%;
  text-align: center;
}
              
            
!

JS

              
                	$(function () {
		$(".btn").on("click", function () {
			$(this).closest("div").css("display", "none");
			id = $(this).attr("href");
			$(id).addClass("fit").show("slow");
		});
	});
	
              
            
!
999px

Console