Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="body">
  <div class="questions" x-data="{
                            start: true,
                            question1: false,
                            question2: false,
                            question3: false,
                            answer1: false,
                            answer2: false,
                            answer3: false,
                                 top: false
                            }">
  <button class="start" x-on:click="question1 = ! question1
                      start = ! start"
          x-show="start"
          x-transition.duration.500ms>診断スタート!</button>
        <section class="section"
             x-show="question1"
             x-transition:enter.duration.500ms
             x-transition:leave.duration.600ms
             x-transition:enter.delay.500ms>
      <h2 class="question">Q1.犬派?猫派?</h2>
      <div class="answer">
        <button x-on:click="question2 = ! question2
                            question1 = ! question1">犬派</button>
        <button x-on:click="question3 = ! question3
                            question1 = ! question1">猫派</button>
      </div>
    </section>
  <section class="section"
           x-show="question2"
           x-transition:enter.duration.500ms
           x-transition:leave.duration.600ms
           x-transition:enter.delay.800ms>
    <h2 class="question">Q2.どのサイズの犬が好き?</h2>
    <div class="answer">
      <button x-on:click="answer1 = ! answer1
                          question2 = ! question2
                          top = ! top">大型</button>
      <button x-on:click="answer2 = ! answer2
                          question2 = ! question2
                          top = ! top">中型</button>
      <button x-on:click="answer3 = ! answer3
                          question2 = ! question2
                          top = ! top">小型</button>
    </div>
  </section>
  <section class="section"
           x-show="question3"
           x-transition:enter.duration.500ms
           x-transition:leave.duration.600ms
           x-transition:enter.delay.800ms>
    <h2 class="question">Q2.どのサイズの猫が好き?</h2>
    <div class="answer">
      <button x-on:click="answer1 = ! answer1
                          question3 = ! question3
                          top = ! top">大型</button>
      <button x-on:click="answer2 = ! answer2
                          question3 = ! question3
                          top = ! top">中型</button>
      <button x-on:click="answer3 = ! answer3
                          question3 = ! question3
                          top = ! top">小型</button>
    </div>
  </section>
  <section class="section"
           x-show="answer1"
           x-transition:enter.duration.500ms
           x-transition:leave.duration.600ms
           x-transition:enter.delay.800ms>
    <h2 class="answer_title">大きい犬も猫も可愛いよね</h2>
    <p class="answer_text">可愛いと思います。だって大きいから。</p>
           </section>
    <section class="section"
           x-show="answer2"
           x-transition:enter.duration.500ms
           x-transition:leave.duration.600ms
           x-transition:enter.delay.800ms>
    <h2 class="answer_title">中くらいの犬も猫も可愛いよね</h2>
    <p class="answer_text">可愛いと思います。だっていい感じのサイズだから。</p>
           </section>
    <section class="section"
           x-show="answer3"
           x-transition:enter.duration.500ms
           x-transition:leave.duration.600ms
           x-transition:enter.delay.800ms>
    <h2 class="answer_title">小さい犬も猫も可愛いよね</h2>
    <p class="answer_text">可愛いと思います。だってミニマムだから。</p>
           </section>
</div>
</div>

              
            
!

CSS

              
                .body {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
}

.questions {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 500px);
  height: min(100%, 500px);
  border: 3px solid #000;
  border-radius: 15px;
  z-index: 0;
  box-shadow: 8px 8px 0px 0px rgba(0, 0, 0, 1);
  padding: 40px 15px;
  
  .start {
      border: 3px solid #000;
      border-radius: 15px;
      box-shadow: 2px 2px 0px 0px rgba(0, 0, 0, 1);
    background: none;
      font-size: 25px;
      font-weight: bold;
      padding: 8px 15px;
    margin: auto;
    }
  
  .section {
    position: absolute;
    width: calc(100% - 30px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
    
    .question {
      width: 100%;
      font-size: 30px;
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console