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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <body class="text-center text-white bg-dark h-100 d-flex flex-column" x-data="{ showModal: false, name: '', email: '', success: false }">

    <div class=" d-flex h-100 p-3 mx-auto flex-column">
      

      <main role="main" class="flex-grow-1 mt-auto d-flex flex-column justify-content-center">
        <h1 class="cover-heading">New widget launching soon.</h1>
        <p class="lead">Not long to go until Acme Inc launch their latest product.</p>
        <p class="alert alert-success" x-show="success">Thanks <span x-text="name"></span> we will be in touch.</p>
        <p class="lead"  x-show="!success">
          <button class="btn btn-lg btn-secondary" @click="showModal = true" >Get in touch</button>
        </p>
      </main>

      <footer class="mastfoot mt-auto">
        <div class="inner">
          <p>Demo of AlpineJS for Smashing Magazine.</p>
        </div>
      </footer>
    </div>

    <div class="modal  fade text-dark" :class="{ 'show d-block': showModal }" x-show="showModal" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">Get in touch</h5>
            <button type="button" class="close" aria-label="Close" @click="showModal = false" >
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <form>
          <div class="modal-body">
            <div class="form-group">
              <label for="name">Your name</label>
              <input type="text" class="form-control" name="name" x-model="name" >
            </div>

            <div class="form-group">
              <label for="email">Your email</label>
              <input type="email" class="form-control" name="email" x-model="email" >
            </div>
           
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary" :disabled="!name || !email" @click="submitForm({name: name, email: email}).then(() => {
                showModal = false;
                success= true;
              })">Submit</button>
          </div>
        </form>
        </div>
      </div>
    </div>
              
            
!

CSS

              
                
              
            
!

JS

              
                function submitForm(data){
        return fetch('https://httpstat.us/200', {
          method: 'POST',
          body: JSON.stringify(data)
        });
      }
              
            
!
999px

Console