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 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

              
                <!--  
View the step by step video tutorial on how to create this login form with only css(sass) and html

https://youtu.be/dok2xAaheWk
-->

<div class="wrapper">
        <div class="container">
            <div class="tabs">
                <!-- Sign In -->
                <input type="radio" class="tabs__button" name="signForm" id="signIn" checked />
                <label class="tabs__text" for="signIn">Sign In</label>
                <div class="tabs__content">
                    <h1>Welcome back!</h1>
                    <p>Get back on your track</p>
                    <form class="form">
                        <div class="input-group">
                            <input class="input-group__input" type="text" placeholder="&nbsp;" name="username" id="username" autocomplete="off" required />
                            <label class="input-group__label" for="username">Username</label>
                        </div>
                        <div class="input-group">
                            <input class="input-group__input" type="password" name="password" placeholder="&nbsp;" id="password" required />
                            <label class="input-group__label" for="password">Password</label>
                        </div>
                        <!-- Normally I would create a grid system or use an existing to cater this issue -->
                        <div class="flex-space-between">
                            <label class="flex-align-center"><input type="checkbox" /> Remember Me</label>
                            <p><a href="#">Forgot Password?</a></p>
                        </div>
                        <button type="submit">Submit</button>
                    </form>
                </div>

                <!-- Sign Up -->
                <input type="radio" class="tabs__button" name="signForm" id="signUp" />
                <label class="tabs__text" for="signUp">Sign Up</label>
                <div class="tabs__content">
                    <h1>New Account</h1>
                    <p>Start your journey now</p>
                    <form class="form">
                        <div class="input-group">
                            <input class="input-group__input" type="email" placeholder="&nbsp;" name="username" id="username" autocomplete="off" required />
                            <label class="input-group__label" for="email">Email</label>
                        </div>
                        <div class="input-group">
                            <input class="input-group__input" type="password" name="password" placeholder="&nbsp;" id="password" required />
                            <label class="input-group__label" for="password">Password</label>
                        </div> 
                        <p><small>By submitting this form, you confirm you have read and agreed to the <a href="#">Terms and Conditions.</a></small></p>
                        <button type="submit">Submit</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

// Color
$gray: #999999;
$dark-gray: #333333;
$blue: #0086e4;

$primary-color: $blue;
$border-color: #dddddd;

// Font
$primary-font: 'Lato', sans-serif;

// Typography
$body-font-family: $primary-font;
$body-font-size: 14px;
$body-color: $dark-gray;

// Input
$input-height: 40px;

// Button
$button-height: $input-height;

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font: {
    family: $body-font-family;
    size: $body-font-size;
  }
  color: $body-color;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  + p {
    color: $gray;
    margin-bottom: 30px;
  }
}

p {
  margin-bottom: 20px; 
}

a {
  color: $primary-color;
  text-decoration: none;
}

input[type="checkbox"] {
  margin: 0;
  padding: 0;
  height: 17px;
}

.wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  // display: flex;
  // align-items: center;
  // justify-content: center;
  background: rgb(150,0,150);
  background: linear-gradient(225deg, rgba(150,0,150,1) 0%, rgba(107,36,205,1) 50%, rgba(0,104,255,1) 100%);
}

.container {
  width: 100%;
  height: auto;
  max-width: 400px;
  min-width: 320px;
  background-color: white;
}


// Util
// You can create a different file to store all utilities classes
.flex-space-between {
  display: flex;
  justify-content: space-between;
}

.flex-align-center {
  display: flex;
  justify-content: center;
  gap: 5px;
}

button {
    cursor: pointer;
    background-color: $primary-color;
    color: white;
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 6px;
    letter-spacing: 1px;
    width: 100%;
    height: $button-height;
    transition: 300ms background-color ease-in-out;
    &:hover {
        background-color: lighten($primary-color, 10%);
    }
}

.input-group {
    margin-bottom: 20px;
    position: relative;
    &__label {
        display: block;
        position: absolute;
        top: 0;
        // to keep the position center
        line-height: $input-height;
        color: #aaa;
        left: 5px;
        padding: 0 5px;
        transition: line-height 200ms ease-in-out,
            font-size 200ms ease-in-out, 
            top 200ms ease-in-out;
        // firefox fix
        pointer-events: none;
    }
    &__input {
        width: 100%;
        height: $input-height;
        border: 1px solid $border-color;
        border-radius: 3px;
        padding: 0 10px;
        // there must a required prop in input
        // &:valid,
        // need to add placeholder
        &:not(:placeholder-shown),
        &:focus {
            + label {
                background-color: white;
                line-height: 10px;
                opacity: 1;
                font-size: 10px;
                top: -5px;
            }
        }
        &:focus {
            outline: none;
            border: 1px solid $primary-color;
            + label {
                color: $primary-color;
            }
        }
    }
}

.tabs {
    $parent: &;
    display: flex;
    flex-flow: row wrap;
    &__text {
        flex: 1;
        margin: 0;
        cursor: pointer;
        padding: 20px 30px;
        font-size: 1.2em;
        opacity: 0.5;
        background-color: #eeeeee;
        border-top: 3px solid #eeeeee;
        transition: border-top 300ms ease-out;
        transform-origin: top;
        text-transform: uppercase;
        font-weight: bold;
        text-align: center;
    }
    &__content {
        display: none;
        flex: 1 1 100%;
        order: 99;
        padding: 40px 30px 30px 30px;
    }
    &__button {
        visibility: hidden;
        height: 0;
        margin: 0;
        position: absolute;
        &:checked {
            + #{$parent}__text {
                // order: -1;
                color: $primary-color;
                opacity: 1;
                background-color: white;
                border-top: 3px solid $primary-color;
            }
            + #{$parent}__text + #{$parent}__content {
                display: block;
            }
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console