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="flex flex-col min-h-screen items-center justify-center bg-gradient-to-r from-green-500 to-green-600">
  <h1 class="text-white text-center text-3xl font-bold">
    Alpine.js + Swap View in Login and Sign up page
  </h1>
  <h2>Change Windows location</h2>
  <div class="mt-6 flex flex-col max-w-3xl w-full bg-white p-9 rounded shadow-md">
    <div class="Forms grid grid-rows-1 gap-y-6 max-w-md mx-auto lg:max-w-screen-md lg:grid-cols-1 lg:gap-x-36" x-data="{isLoginView : true }" x-init="$watch('isLoginView', value => {  var route = ''; if(value == 1) { route = 'login'; } else { route = 'register'; } window.history.pushState(null,null, route); })">
      <div class="login" name="登入" x-show="isLoginView" style="display: none;">
        <div class="bg-white rounded-t-lg shadow lg:rounded-lg">
          <h1 class="py-6 px-4 sm:px-6 pb-0 font-bold text-lg lg:pt-10">Login</h1>
          <form action="https://codepen.io/login" method="POST">
            <div class="py-6 pt-4 px-4 sm:p-6 lg:pb-8 lg:flex">
              <div class="grid grid-cols-12 gap-6 text-sm font-bold w-full">
                <div class="col-span-12">
                  <label class="block" for="email">Email</label>

                  <div class="relative">
                    <input class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none  text-base" type="text" name="email" id="email" autocomplete="off" value="" required="required">

                  </div>
                </div>

                <div class="col-span-12">
                  <div class="flex items-center">
                    <input id="login_go_login" name="is_login_view" type="radio" class="focus:ring-red-primary h-4 w-4 text-red-primary border-red-primary" checked="true">
                    <label for="login_go_login" class="ml-3 block text-sm font-medium text-gray-700">
                      I am a registered customer </label>
                  </div>
                  <div class="flex items-center mt-2">
                    <input id="login_go_register" x-model="isLoginView" value="" type="radio" class="focus:ring-red-primary h-4 w-4 text-red-primary border-red-primary" name="isLoginView">
                    <label for="login_go_register" class="ml-3 block text-sm font-medium text-gray-700">
                      Become Member </label>
                  </div>
                </div>

                <div class="col-span-12" x-data="{ show: true }">
                  <label class="block" for="password">Password</label>

                  <div class="relative">
                    <input class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none  text-base" :type="show ? 'password' : 'text'" name="password" id="password" required="required" type="password">
                    <div class="inset-center-y right-4 cursor-pointer">

                    </div>
                  </div>
                </div>

              </div>
            </div>

          </form>
        </div>
      </div>
      <div class="create-account" x-show="!isLoginView" name="Become Member">
        <div class="bg-white rounded-t-lg shadow lg:rounded-lg">
          <h1 class="py-6 px-4 sm:px-6 pb-0 font-bold text-lg lg:pt-10">Become Member</h1>
          <form action="https://codepen.io/register" method="POST">
            <div class="py-6 px-4 sm:p-6 lg:pb-8 lg:flex">

              <div class="grid grid-cols-12 gap-6 text-sm font-bold w-full">
                <div class="col-span-12 ">
                  <label class="block" for="email">Email<sup class="text-red-primary">*</sup></label>

                  <div class="relative">
                    <input class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none  text-base" type="email" name="email" id="email" autocomplete="off">

                  </div>

                </div>

                <div class="col-span-12">
                  <div class="flex items-center">
                    <input id="reg_go_login" x-model="isLoginView" value="1" type="radio" name="is_login_view" class="focus:ring-red-primary h-4 w-4 text-red-primary border-red-primary">
                    <label for="reg_go_login" class="ml-3 block text-sm font-medium text-gray-700">
                      I am a registered customer </label>
                  </div>
                  <div class="flex items-center mt-2">
                    <input id="reg_go_register" type="radio" class="focus:ring-red-primary h-4 w-4 text-red-primary border-red-primary" checked="">
                    <label for="reg_go_register" class="ml-3 block text-sm font-medium text-gray-700">
                      Become Member </label>
                  </div>
                </div>

                <div class="col-span-12">
                  <label class="block" for="first_name">Name<sup class="text-red-primary">*</sup></label>

                  <div class="relative">
                    <input class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none  text-base" type="text" name="first_name" id="first_name" autocomplete="given-name">

                  </div>
                </div>

                <div class="col-span-12" x-data="{ show: true }">
                  <label class="block" for="password">Password</label>

                  <div class="relative">
                    <input class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none  text-base" :type="show ? 'password' : 'text'" name="password" id="password" autocomplete="off" type="password">
                    <div class="inset-center-y right-4 cursor-pointer">

                    </div>
                  </div>
                </div>

              </div>
            </div>

          </form>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console