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

              
                <header>
	<h1>a11y sign in&#8725;up</h1>
	<p class="page-title--sub">(desktop only)</p>
</header>
<main class="container" id="container">
	<!--   Sign in -->
	<section class="form-container sign-in-container">
		<form id="signInForm">
			<fieldset>
				<legend>
					<h1>Sign in</h1>
				</legend>
				<section role="group" aria-label="Sign in using a social media account" class="social-container">
					<a id="socialSignIn" href="#" class="social" aria-label="Facebook account" title="Facebook sign in">
						<i class="fab fa-facebook-f"></i></a>
					<a href="#" class="social" aria-label="Google+ account" title="Google+ sign in">
						<i class="fab fa-google-plus-g"></i></a>
					<a href="#" class="social" aria-label="Linkedin account" title="Linkedin sign in">
						<i class="fab fa-linkedin-in"></i></a>
				</section>
				<section role="group" aria-labelledby="signInEmailFields">
					<h2 id="signInEmailFields" class="sub-section__title">or use your email<span class="a11ytxt"> to sign in</span></h2>
					<label for="signInEmail">email</label>
					<input id="signInEmail" name="email" type="email" autocomplete="email" />
					<label for="signInPassword">password</label>
					<input id="signInPassword" name="password" type="password" autocomplete="current-password" />
					<p class="password-reminder">
						<a href="#">Forgot your password?</a>
					</p>
				</section>
			</fieldset>
			<button type="submit">Sign In</button>
		</form>
	</section>
	<!--   Sign up -->
	<section class="form-container sign-up-container">
		<form id="signUpForm">
			<fieldset>
				<legend>
					<h1>Create an account</h1>
				</legend>
				<section role="group" aria-label="Sign up using a social media account" class="social-container">
					<a id="socialSignUp" href="#" class="social" aria-label="Facebook account">
						<i class="fab fa-facebook-f"></i></a>
					<a href="#" class="social" aria-label="Google+ account">
						<i class="fab fa-google-plus-g"></i></a>
					<a href="#" class="social" aria-label="Linkedin account">
						<i class="fab fa-linkedin-in"></i></a>
				</section>
				<section role="group" aria-labelledby="signUpEmailFields">
				<h2 id="signUpEmailFields" class="sub-section__title">or use your email <span class="a11ytxt">to sign up</span></h2>
				<label for="username">username</label>
				<input id="username" type="text" name="username" autocomplete="username" />
				<label for="signUpEmail">email</label>
				<input id="signUpEmail" type="email" name="email" autocomplete="email" />
				<label for="signUpPassword">password</label>
				<input id="signUpPassword" type="password" name="password" autocomplete="new-password" />
					</section>
				<button type="submit">Sign Up</button>
			</fieldset>
		</form>
	</section>
	<div class="overlay-container">
		<div class="overlay">
			<div class="overlay-panel overlay-right">
				<h1 id="signUpOverlayHeading">Don't have an account?</h1>
				<button class="ghost" id="signUp" aria-describedby="signUpOverlayHeading">Sign Up</button>
			</div>
			<div class="overlay-panel overlay-left">
				<h1 id="signInOverlayHeading">Already have an account?</h1>
				<button class="ghost" id="signIn" tabindex="-1" aria-describedby="signInOverlayHeading">Sign In</button>
			</div>
		</div>
	</div>
</main>

<footer>
	<p>Made accessible 👩‍💻 by <a href="https://github.com/krisztin" target="_blank" noreferrer noopener>krisztin</a>, original version by
		<a target="_blank" noreferrer noopener href="https://www.florin-pop.com/blog/2019/03/double-slider-sign-in-up-form/">Florin Pop</a>. <br> Read about <a href="https://www.kriszt.in/blog/a11yform" target="_blank" noreferrer noopener>how I've done it and why</a>.
	</p>
</footer>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat:400,800');

:root {
  --colour-primary: #E00034;
	/*had to tweak primary colour as it had barely any contrast*/
  --colour-grey: #2b2b2b;
  --colour-grey--light: #a8a8a8;
	--colour-focus: #ffdd00;
	
	--font: 'Montserrat', sans-serif;
}

* {
	-webkit-box-sizing: border-box;
	        box-sizing: border-box;
}

body {
	background: #f6f5f7;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	    -ms-flex-direction: column;
	        flex-direction: column;
	font-family: var(--font);
	height: 100%;
	margin: 0 0 10rem;
}

fieldset {
	border: none;
	padding: 0;
	width: 100%;
}

section {
  width: 100%;
}

h1 {
	margin: 0;
	padding-top: 1em;
  font-size: 2rem;
}

header {
  max-width: 500px;
  text-align: center;
}

.page-title--sub {
	margin: 0 0 2rem;
}

.a11ytxt {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.sub-section__title {
  font-size: 0.9rem;
  font-weight: normal;
  position: relative;
  display: inline-block;
  margin: 0.5rem 0;
}


/* Horizontal line before and after the section 
divider "or use your email"*/
.sub-section__title:after,
.sub-section__title:before{
  position: absolute;
  content: '';
  width: 40%;
  height: 1px;
  background: var(--colour-grey--light);
  top: 0.45rem;
}
.sub-section__title:after {  
  margin-left: 1rem;
  left: 100%;
}
.sub-section__title:before {
  margin-right: 1rem;
  right: 100%;
}

/*****
 anchor links
*****/

a {
  color: var(--colour-primary);
  font-weight: bold;
}

a:focus {
	background: var(--colour-focus);
	color: #000;
}

/* Social links */
a.social {
  font-size: 1.2rem;
	color: #000;
	text-decoration: none;
	margin: 1rem 0;
}

a.social:hover {
  color: var(--colour-primary);
  border: 3px solid var(--colour-primary);
}

a.social:active {
	color: #000;
  background-color: var(--colour-primary);
}

.social-container {
	margin: 1.5rem 0 0.5rem;
}

.social-container a {
	border: 1px solid var(--colour-grey--light);
	border-radius: 50%;
	display: -webkit-inline-box;
	display: -ms-inline-flexbox;
	display: inline-flex;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	margin: 0 0.5rem;
	height: 3rem;
	width: 3rem;
}

.password-reminder {
  text-align: left;
  margin: 0 0 1rem;
}

.password-reminder a {
  font-size: 0.9rem;
}

/*****
 buttons
*****/

button {
  cursor: pointer;
	border-radius: 20px;
	border: 1px solid var(--colour-primary);
	background-color: var(--colour-primary);
	color: #FFFFFF;
  font-family: inherit;
  font-size: 0.85rem;
	font-weight: bold;
	padding: 12px 45px;
	letter-spacing: 1px;
	text-transform: uppercase;
	-webkit-transition: -webkit-transform 80ms ease-in;
	transition: -webkit-transform 80ms ease-in;
	-o-transition: transform 80ms ease-in;
	transition: transform 80ms ease-in;
	transition: transform 80ms ease-in, -webkit-transform 80ms ease-in;
  margin-top: 0.5rem;
}

button:hover {
	-webkit-transform: scale(1.05);
	    -ms-transform: scale(1.05);
	        transform: scale(1.05);
  -webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.15), 
			0 5px 5px rgba(0,0,0,0.12);
          box-shadow: 0 4px 8px rgba(0,0,0,0.15), 
			0 5px 5px rgba(0,0,0,0.12);
}

button:active {
	-webkit-transform: scale(0.95);
	    -ms-transform: scale(0.95);
	        transform: scale(0.95);
}

button:focus,
input:focus {
	color: #000;
	outline-offset: 0px;
	box-shadow: 0px 0px 0px 2px inset;
	outline:  var(--colour-focus) solid 3px;
}

button:focus {
  box-shadow: #000 0px 0px 0px 4px inset;
}

/* Don't do this */
/* button:focus {
	outline: none;
} */

button.ghost {
	background-color: transparent;
	border-color: #FFF;
}

/*****
 Forms
*****/
#signUpForm {
  display: none;
}

form {
	background-color: #FFF;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	    -ms-flex-direction: column;
	        flex-direction: column;
	padding: 2.5rem;
	height: 100%;
	text-align: center;
}

input {
	border: 1px solid var(--colour-grey--light);
	padding: 0.8rem;
	margin-bottom: 1rem;
	width: 100%;
}

label {
  margin-bottom: 0.2rem;
  display: block;
  font-size: 0.9rem;
  font-weight: bold;
  text-align: left;
  width: 100%;
}

.container {
	background-color: #fff;
	border-radius: 10px;
  	-webkit-box-shadow: 0 14px 28px rgba(0,0,0,0.25), 
			0 10px 10px rgba(0,0,0,0.22);
  	        box-shadow: 0 14px 28px rgba(0,0,0,0.25), 
			0 10px 10px rgba(0,0,0,0.22);
	position: relative;
	overflow: hidden;
	width: 800px;
	max-width: 100%;
	min-height: 550px;
}

.form-container {
  padding: 1rem;
	position: absolute;
	top: 0;
	height: 100%;
	-webkit-transition: all 0.6s ease-in-out;
	-o-transition: all 0.6s ease-in-out;
	transition: all 0.6s ease-in-out;
}

.sign-in-container {
	left: 0;
	width: 50%;
	z-index: 2;
}

.container.right-panel-active .sign-in-container {
	-webkit-transform: translateX(100%);
	    -ms-transform: translateX(100%);
	        transform: translateX(100%);
}

.sign-up-container {
	left: 0;
	width: 50%;
	opacity: 0;
	z-index: 1;
}

.container.right-panel-active .sign-up-container {
	-webkit-transform: translateX(100%);
	    -ms-transform: translateX(100%);
	        transform: translateX(100%);
	opacity: 1;
	z-index: 5;
	-webkit-animation: show 0.6s;
	        animation: show 0.6s;
}

@-webkit-keyframes show {
	0%, 49.99% {
		opacity: 0;
		z-index: 1;
	}
	
	50%, 100% {
		opacity: 1;
		z-index: 5;
	}
}

@keyframes show {
	0%, 49.99% {
		opacity: 0;
		z-index: 1;
	}
	
	50%, 100% {
		opacity: 1;
		z-index: 5;
	}
}

.overlay-container {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	overflow: hidden;
	-webkit-transition: -webkit-transform 0.6s ease-in-out;
	transition: -webkit-transform 0.6s ease-in-out;
	-o-transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
	z-index: 100;
}

.container.right-panel-active .overlay-container{
	-webkit-transform: translateX(-100%);
	    -ms-transform: translateX(-100%);
	        transform: translateX(-100%);
}

.overlay {
	background: #FF416C;
	background: -webkit-gradient(linear, left top, right top, from(#FF4B2B), to(var(--colour-primary)));
	background: -o-linear-gradient(left, #FF4B2B, var(--colour-primary));
	background: linear-gradient(to right, #FF4B2B, var(--colour-primary));
	background-repeat: no-repeat;
	background-size: cover;
	background-position: 0 0;
	color: #FFF;
	position: relative;
	left: -100%;
	height: 100%;
	width: 200%;
  	-webkit-transform: translateX(0);
  	    -ms-transform: translateX(0);
  	        transform: translateX(0);
	-webkit-transition: -webkit-transform 0.6s ease-in-out;
	transition: -webkit-transform 0.6s ease-in-out;
	-o-transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}

.container.right-panel-active .overlay {
  	-webkit-transform: translateX(50%);
  	    -ms-transform: translateX(50%);
  	        transform: translateX(50%);
}

.overlay-panel {
	position: absolute;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	-webkit-box-orient: vertical;
	-webkit-box-direction: normal;
	    -ms-flex-direction: column;
	        flex-direction: column;
	padding: 0 40px;
	text-align: center;
	top: 0;
	height: 100%;
	width: 50%;
	-webkit-transform: translateX(0);
	    -ms-transform: translateX(0);
	        transform: translateX(0);
	-webkit-transition: -webkit-transform 0.6s ease-in-out;
	transition: -webkit-transform 0.6s ease-in-out;
	-o-transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out;
	transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}

.overlay-left {
	-webkit-transform: translateX(-20%);
	    -ms-transform: translateX(-20%);
	        transform: translateX(-20%);
}

.container.right-panel-active .overlay-left {
	-webkit-transform: translateX(0);
	    -ms-transform: translateX(0);
	        transform: translateX(0);
}

.overlay-right {
	right: 0;
	-webkit-transform: translateX(0);
	    -ms-transform: translateX(0);
	        transform: translateX(0);
}

.container.right-panel-active .overlay-right {
	-webkit-transform: translateX(20%);
	    -ms-transform: translateX(20%);
	        transform: translateX(20%);
}

footer {
    background-color: var(--colour-grey);
    color: #fff;
    font-size: 14px;
    bottom: 0;
    position: fixed;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 999;
}

footer a {
	color: #fff;
}
              
            
!

JS

              
                const signUpButton = document.getElementById("signUp");
const signInButton = document.getElementById("signIn");
const container = document.getElementById("container");
const signUpForm = document.getElementById("signUpForm");
const signInForm = document.getElementById("signInForm");

signUpButton.addEventListener("click", () => {
	const socialSignUp = document.getElementById("socialSignUp");
	container.classList.toggle("right-panel-active");
	
	// 1. Make the sign up form visible/focusable
	// i.e. put it back in the DOM to be accessed by
	// screen readers
	signUpForm.style.display = "flex";

	// 2. Take the singIn out of index and put the signUp in
	signInButton.tabIndex = 0;
	signUpButton.tabIndex = -1;
	
	// 3. Pull focus on the other form's first social link
	socialSignUp.focus();

	  // display cannot be animated
	  // the timeout workaround enables the animation to run
	setTimeout(function() {
		signInForm.style.display = "none";	
	}, 300);
});

signInButton.addEventListener("click", () => {
	const socialSignIn = document.getElementById("socialSignIn");

	container.classList.toggle("right-panel-active");
	signInForm.style.display = "flex";
	signInButton.tabIndex = -1;
	signUpButton.tabIndex = 0;
	socialSignIn.focus();

	setTimeout(function() {
		signUpForm.style.display = "none";
	}, 300);
});

const forms = document.querySelectorAll('form'),
    fn      = function(e) { e.preventDefault() };

for ( var i = forms.length; i--; ) {
    forms[i].addEventListener('click', fn, false);
}
              
            
!
999px

Console