I Googled for the above mentioned problem, but I still require the help from the stack overflow community.
In my login form, I am using font awesome icon. I have 2 input boxes for username and password respectively.
I want to display fa-user-cirle icon on top of the username input. The login form is displayed in a div as follows:
<div class="loginDiv">
<form>
<i class="fa fa-user-circle"></i>
<div class="container">
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required>
<button mat-button (click)="submit()">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
</form>
</div>
The CSS for icon is:
#import '~#angular/material/theming';
#include mat-core();
$yaana-app-primary: mat-palette($mat-orange, 800,400,200);
.firstDiv {
height: 40%;
width: 100%;
top: 0;
left: 0;
right: 0;
position: absolute;
background-color: orangered;
display: inline-block;
}
.secondDiv {
position: absolute;
width: 100%;
bottom: 0;
height: 60%;
left: 0;
right: 0;
background-color:whitesmoke;
display: inline-block;
}
.loginDiv {
border: 1px solid black;
background: white;
left: 50%;
position: absolute;
top: 28%;
transform: translate(-50%);
background-color: #fff;
padding: 15px;
box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
width: 215px;
height: 36px;
line-height: 36px;
background: transparent;
border-radius: 3px;
will-change: transform;
-webkit-transition: all .2s ease;
transition: all .2s ease;
border: none;
/*border: 2px solid #FF5126;*/
cursor: pointer;
background: #F26722;
font-size: 16px;
color: #fff;
outline: none;
text-align: center;
padding: 0 6px;
margin: 6px 8px;
font-size: 14px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
text-transform: uppercase !important;
}
button:hover {
opacity: 0.8;
}
.loginImgContainer {
display: table;
max-height: 40px;
max-width: 40px;
}
i.fa {
background: #fff;
display: inline-block;
transform: scale(4,4);
border-radius: 50%;
}
The output I am getting is as follows:
But I want the icon to appear just above the username input and at the centre.
Please help me.
Adding this 'centericon' Class and css
.centericon{
font-size:36px;
position:absolute;
top:-18px;
left:50%;
transform:translate(-50%,0);
z-index:99;
background:white;
}
.firstDiv {
height: 40%;
width: 100%;
top: 0;
left: 0;
right: 0;
position: absolute;
background-color: orangered;
display: inline-block;
}
.secondDiv {
position: absolute;
width: 100%;
bottom: 0;
height: 60%;
left: 0;
right: 0;
background-color:whitesmoke;
display: inline-block;
}
.loginDiv {
border: 1px solid black;
background: white;
left: 50%;
position: absolute;
top: 28%;
transform: translate(-50%);
background-color: #fff;
padding: 15px;
box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
width: 215px;
height: 36px;
line-height: 36px;
background: transparent;
border-radius: 3px;
will-change: transform;
-webkit-transition: all .2s ease;
transition: all .2s ease;
border: none;
/*border: 2px solid #FF5126;*/
cursor: pointer;
background: #F26722;
font-size: 16px;
color: #fff;
outline: none;
text-align: center;
padding: 0 6px;
margin: 6px 8px;
font-size: 14px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
text-transform: uppercase !important;
}
button:hover {
opacity: 0.8;
}
.loginImgContainer {
display: table;
max-height: 40px;
max-width: 40px;
}
.centericon{
font-size:36px;
position:absolute;
top:-18px;
left:50%;
transform:translate(-50%,0);
z-index:99;
background:white;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<div class="loginDiv">
<form>
<div class="centericon">
<i class="fa fa-user-circle"></i>
</div>
<div class="container">
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required>
<button mat-button (click)="submit()">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
</form>
</div>
Try with adding row above the container,
<div class="loginDiv">
<form>
<div class="row center">
<i class="fa fa-user-circle"></i>
</div>
<div class="container">
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required>
<button mat-button (click)="submit()">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
</form>
</div>
Thanks for giving me hint and found out the solution with following changes in css,
i.fa {
background: #fff;
display: inline-block;
font-size: 80px;
transform: translateY(-60%);
transform: translateX(160%);
border-radius: 50%;
}
Related
Ok so I was following a youtube tutorial for an HTML and CSS form that gave animations. Here is the entire HTML for it..
<div class="hero">
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button type="button" class="toggle-btn" onclick="login()">Login</button>
<button type="button" class="toggle-btn" onclick="signup()">Signup</button>
</div>
<div class="social-icons">
<img src="../images/google-logo.png">
</div>
<form id="login" class="input-groups">
<input id="usernameL" type="text" class="input-field" placeholder="Userid" required>
<input id="passL" type="text" class="input-field" placeholder="password" required>
<input type="checkbox" class="chech-box"><span>Remember Me</span>
<button type="submit" class="submit-btn">Login</button>
</form>
<form id="signup" class="input-groups">
<input id="usernameSP" type="text" class="input-field" placeholder="Userid" required>
<input id="emailSP" type="email" class="input-field" placeholder="Email" required>
<input id="passSP" type="text" class="input-field" placeholder="password" required>
<input type="checkbox" class="chech-box"><span>I agree to terms and conditions</span>
<button type="submit" class="submit-btn">SignUp!</button>
</form>
</div>
</div>
<script>
var x= document.getElementById("login");
var y= document.getElementById("signup");
var z= document.getElementById("btn");
function signup(){
x.style.left ="-480px";
y.style.left ="50px";
z.style.left ="110px";
}
function login(){
x.style.left ="50px";
y.style.left ="-450px";
z.style.left ="0";
}
</script>
There is also a js file that called functions as login so I thought that was changed the problem and I changed it to login1 in js file but that didn't do anything...
I'm pretty sure my CSS is also proper so I'm not sure I understand what the problem is..
* {
margin: 0;
padding: 0;
}
.hero {
height: 100%;
width: 100%;
background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
url("../images/citybanner.jpg");
background-position: center;
background-size: cover;
position: absolute;
}
.form-box {
width: 380px;
height: 480px;
position: relative;
margin: 6% auto;
background: white;
padding: 5px;
overflow: hidden;
}
.button-box {
width: 220px;
margin: 35px auto;
position: relative;
box-shadow: 0 0 20px 9px #ff61241f;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
top: 0;
left: 0;
position: absolute;
width: 110px;
height: 100%;
background: linear-gradient(to right, #ff105f, #ffad06);
border-radius: 30px;
transition: 0.5s;
}
.social-icons {
margin: 30px auto;
text-align: center;
}
.social-icons img {
width: 30px;
border-radius: 50px;
}
.input-group{
top: 180px;
position: absolute;
width: 280px;
transition: .5s;
}
.input-field{
width: 100px;
padding: 10px 0;
margin: 5px 0;
border-left: 0;
border-top: 0;
border-right: 0;
border-bottom: 1px solid #999;
outline: none;
background: transparent;
}
.submit-btn{
width: 85%;
padding: 10px 30px;
cursor:pointer;
display: block;
margin:auto;
background: linear-gradient(to right, #ff105f, #ffad06);
border: 0;
outline: none;
border-radius: 30px;
}
.chech-box{
margin: 30px 10px 30px 0;
}
span{
color: #777;
font-size: 12px;
bottom: 64px;
position: absolute;
}
#login{
left: 50px;
}
#signup{
left: 450px;
}
The form itself. The login and signup buttons work where the color gradient changes but the actual content of the form doesn't change.
I'm sure this is something simple but i'm exhausted trying to figure it out. I've tried a lot of different variations and I just can't get the search button to sit on the same line as the search bar. I'm at my wits end. Why are they on two different lines???
.container-inner {
width: 100%;
position: relative;
display: flex;
}
#search-bar {
width: 90%;
border: 2px solid #fff200;
border-right: none;
padding: 5px;
height: 40px;
border-radius: 5px 0 0 5px;
outline: none;
color: #9DBFAF;
}
#search-bar:focus{
color: black;
}
.searchButton {
width: 40px;
height: 36px;
border: 2px solid #fff200;
background: grey;
text-align: center;
color: black;
border-radius: 0 5px 5px 0;
cursor: pointer;
font-size: 20px;
}
.searchButton:hover{
background: darkslategrey
}
.container {
width: 50%;
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="container">
<div class="container-inner">
<form id="search-form">
<div class="input-group input-group-lg">
<input id="search-bar" class="form-control search-bar" placeholder="Search for a song...">
<button type="submit" class="searchButton">
<i class="fa fa-search" aria-hidden="true"></i>
</div>
</div>
</form>
</div>
You should change add a wrapper with display flex, set the property flex of #search-bar to 1 and remove the height from the #search-bar as in the following example.
.container-inner {
width: 100%;
position: relative;
display: flex;
}
#search-bar {
border: 2px solid #fff200;
border-right: none;
padding: 5px;
border-radius: 5px 0 0 5px;
outline: none;
color: #9DBFAF;
flex: 1;
}
#search-bar:focus {
color: black;
}
.searchButton {
width: 40px;
height: 36px;
border: 2px solid #fff200;
background: grey;
text-align: center;
color: black;
border-radius: 0 5px 5px 0;
cursor: pointer;
font-size: 20px;
}
.searchButton:hover {
background: darkslategrey
}
.container {
width: 50%;
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, -50%);
}
.input-wrapper {
display: flex;
}
<div class="container">
<div class="container-inner">
<form id="search-form">
<div class="input-group input-group-lg input-wrapper">
<input id="search-bar" class="form-control search-bar" placeholder="Search for a song...">
<button type="submit" class="searchButton">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</div>
</form>
</div>
</div>
Give .input-group display: flex;
.container-inner {
width: 100%;
position: relative;
display: flex;
}
#search-bar {
width: 90%;
border: 2px solid #fff200;
border-right: none;
padding: 5px;
height: 40px;
border-radius: 5px 0 0 5px;
outline: none;
color: #9DBFAF;
}
#search-bar:focus{
color: black;
}
.searchButton {
width: 40px;
height: 36px;
border: 2px solid #fff200;
background: grey;
text-align: center;
color: black;
border-radius: 0 5px 5px 0;
cursor: pointer;
font-size: 20px;
}
.searchButton:hover{
background: darkslategrey
}
.input-group{
display: flex;
}
<div class="container">
<div class="container-inner">
<form id="search-form">
<div class="input-group input-group-lg">
<input id="search-bar" class="form-control search-bar" placeholder="Search for a song...">
<button type="submit" class="searchButton">
<i class="fa fa-search" aria-hidden="true"></i>
</div>
</div>
</form>
</div>
Your width on searchBar of width: 90%; is taking up too much space. 90% of the parent + it's own padding is leaving less than 40px; needed for the button to sit alongside. Remove the width of the searchBar or make it less like 70% etc.
.container-inner {
width: 100%;
position: relative;
display: flex;
}
#search-bar {
border: 2px solid #fff200;
border-right: none;
padding: 5px;
height: 40px;
border-radius: 5px 0 0 5px;
outline: none;
color: #9DBFAF;
}
#search-bar:focus{
color: black;
}
.searchButton {
width: 40px;
height: 36px;
border: 2px solid #fff200;
background: grey;
text-align: center;
color: black;
border-radius: 0 5px 5px 0;
cursor: pointer;
font-size: 20px;
}
.searchButton:hover{
background: darkslategrey
}
.container {
width: 50%;
position: absolute;
top: 20%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="container">
<div class="container-inner">
<form id="search-form">
<div class="input-group input-group-lg">
<input id="search-bar" class="form-control search-bar" placeholder="Search for a song...">
<button type="submit" class="searchButton">
<i class="fa fa-search" aria-hidden="true"></i>
</div>
</div>
</form>
</div>
try changing that display attribute for the inner container
So I'm trying to make a dropdown list overlap the elements below when expanded. Unfortunately, even when elements in the same stacking context have a position, and dropdown container div set to a z-index of 2, the issue still persists; instead of overlapping the elements below, it shifts them down. I have also attempted shuffling around the stacking context by adding the opacity property to various elements, but that hasn't worked either. The code can be seen below:
#firstone {
z-index: 2;
}
#contain {
height: 400px;
width: 400px;
background-color: rgba(100, 25, 25, 0.2);
}
body {
text-align: center;
}
input:focus {
outline: none;
}
.fancy_input_box {
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input {
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input:focus~.dropdown-content {
display: block;
cursor: default;
}
.fancy_input:focus~.dropdown-content>span {
display: block;
cursor: default;
}
.dropdown-content {
display: none;
background-color: rgba(0, 0, 0, 0.2);
width: 222px;
overflow: auto;
position: relative;
}
.dropdown-content:active {
display: block;
}
.dropdown-content>span {
padding: 12px 16px;
display: none;
}
.dropdown-content>span:hover {
background-color: rgba(0, 0, 0, 0.1);
}
.fancy_input~.fancy_label {
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus~.fancy_label {
top: -18px;
left: 1px;
font-size: 12px;
color: grey !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:focus {
border: 1px solid grey !important;
}
.fancy_input:not(focus):valid~.fancy_label {
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="test.css">
</head>
<body>
<div id="contain">
<div id="firstone" class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="25" size="25" required>
<label class="fancy_label">Search</label>
<div class="dropdown-content">
<span>a</span>
<span>b</span>
<span>c</span>
<span>d</span>
<span>e</span>
</div>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">Thing</label>
</div>
<br>
<div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">stuff</label>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">more stuff</label>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">more stuff</label>
</div>
</div>
</div>
</body>
</html>
You dropdown content should be absolute positioned.
Update your dropdown styles as shown below :
.dropdown-content {
display: none;
background-color: rgba(0, 0, 0, 0.2);
width: 222px;
overflow: auto;
position: absolute;
left: 0;
top: 100%;
}
Try following code just set position absolute. also i change width 100% in dropdown-content div for good design.
#firstone {
z-index: 2;
}
#contain {
height: 400px;
width: 400px;
background-color: rgba(100, 25, 25, 0.2);
}
body {
text-align: center;
}
input:focus {
outline: none;
}
.fancy_input_box {
text-align: left;
display: inline-block;
margin: 40px 3% 1px;
position: relative;
}
.fancy_input {
font: 15px/24px "Lato", Arial, sans-serif;
color: #aaa;
box-sizing: border-box;
letter-spacing: 1px;
border: 0;
padding: 7px 7px;
border: 1px solid #ccc;
position: relative;
background: transparent;
}
.fancy_input:focus~.dropdown-content {
display: block;
cursor: default;
}
.fancy_input:focus~.dropdown-content>span {
display: block;
cursor: default;
}
.dropdown-content {
display: none;
background-color: rgba(0, 0, 0, 0.2);
width: 100%;
overflow: auto;
position: absolute;
}
.dropdown-content:active {
display: block;
}
.dropdown-content>span {
padding: 12px 16px;
display: none;
}
.dropdown-content>span:hover {
background-color: rgba(0, 0, 0, 0.1);
}
.fancy_input~.fancy_label {
position: absolute;
left: 14px;
width: 100%;
top: 10px;
color: #aaa;
letter-spacing: 0.5px;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
z-index: -1;
}
.fancy_input:focus~.fancy_label {
top: -18px;
left: 1px;
font-size: 12px;
color: grey !important;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
.fancy_input:focus {
border: 1px solid grey !important;
}
.fancy_input:not(focus):valid~.fancy_label {
top: -18px;
font-size: 12px;
left: 1px;
color: #aaa;
transition: 0.3s;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
}
<div id="contain">
<div id="firstone" class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="25" size="25" required>
<label class="fancy_label">Search</label>
<div class="dropdown-content">
<span>a</span>
<span>b</span>
<span>c</span>
<span>d</span>
<span>e</span>
</div>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">Thing</label>
</div>
<br>
<div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">stuff</label>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">more stuff</label>
</div>
<div class="fancy_input_box">
<input class="fancy_input" type="text" placeholder="" maxlength="4" size="10">
<label class="fancy_label">more stuff</label>
</div>
</div>
</div>
just add position:absoute and top:100%; in your dropdown-content class
jsfiddle from your code
.dropdown-content {
display: none;
background-color: rgba(0, 0, 0, 0.2);
width: 222px;
overflow: auto;
position: absolute;
left: 0;
top: 100%;
}
How do I display "Confirm Password" in a single line ?
I add an <span id="confirm">Confirm Password</span> and I did this, doesn't work:
#confirm {
display: inline;
}
* {
margin: 0px;
padding: 0px;
}
body {
background-color: Royalblue; /*#f0f0f0;*/
}
.head {
text-align: center;
border: 1px solid #B0C4DE;
border-bottom: none;
border-radius: 10px 10px 0px 0px;
padding: 20px;
background: rgba(0, 250, 0, 0);
color: #FFFACD;
font-family: 'Cinzel', sans-serif;
font-size:30px;
}
.content {
position:relative;
top:8px;
width: 30%;
margin: 50px
auto 0px;
}
form {
position: relative;
margin-top: 0;
margin-left: 0;
width: 89%;
height: 300px;
padding: 20px;
border: 1px solid #B0C4DE;
background: rgba(0, 250, 0, 0);
border-radius: 0px 0px 10px 10px;
}
label {
position: relative;
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
left: -65%;
top: -30px;
}
.username {
position: relative;
top: 65px;
}
.password {
position: relative;
top: 130px;
}
.con-pass {
position: relative;
top: 195px;
}
#confirm {
display: inline;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 2px solid beige;
background: transparent;
font-size: 15px; /*BORDER yes/no*/
height: 25px;
width: 250px;
outline: 0;
z-index: 1;
left: -74px;
top: -30px;
}
span {
position: absolute;
top: 5px;
left: -6px;
transition: top .5s ease, font-size .5s ease;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
/* padding-bottom: 15px;*/
}
label::after {
content: '';
position: absolute;
top: 27px; /* ::after position */
left: -7px;
width: 250px;
height: 23px;
border-radius: 2px;
transition: transform .3s;
}
label::after {
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: top;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: 27px; /* ::after position */
}
input:focus {
border-radius: 2px;
}
<div class="content">
<p class="head">Register</p>
<form>
<div class="content">
<div class="email">
<input type="text" id="email" required /> <!--input field-->
<label for="email"><span>Email</span></label>
</div>
<div class="username">
<input type="text" id="user" required />
<label for="user"><span>Username</span></label>
</div>
<div class="password">
<input type="text" id="pass" required /> <!--input field-->
<label for="pass"><span>Password</span></label>
</div>
<div class="con-pass">
<input type="text" id="c-pass" required />
<label for="c-pass"><span id="confirm">Confirm Password</span></label>
</div>
</div>
</form>
</div>
You can use white-space: nowrap; for that :
#confirm {
white-space: nowrap;
}
Here is a resource for the white-space property in CSS.
Use white-space: nowrap; for class con-pass
You can also insert a in your html. That will ensure the two Words are kept on the same line:
<label for="c-pass"><span id="confirm">Confirm Password</span></label>
How do you get an image to overlap to next div below it?
If you don't get my descriptions this is the feature I want.
click here
This is what I have so far
HTML:
<p>overflow:hidden</p>
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible. <img src="https://vetstreet.brightspotcdn.com/dims4/default/8fe930e/2147483647/crop/0x0%2B0%2B0/resize/645x380/quality/90/?url=https%3A%2F%2Fvetstreet-brightspot.s3.amazonaws.com%2F57%2Ff65100a80811e0a0d50050568d634f%2Ffile%2FStaffordshire-Bull-Terrier-3-645mk062811.jpg" alt="Image result for dogs staffordshire terrier"/></div>
CSS:
div.hidden {
background-color: #00FF00;
width: 100%;
height: 100px;
overflow: hidden;
}
This layout some thing like your screenshot , but you have to need better understand CSS positioning attribute. Please checkout........
html,
body {
width: 100%;
height: 100%;
margin: 0;
font-family: Helvetica, Arial, sans-serif;
overflow: hidden;
}
.ghost {
position: absolute;
left: -100%;
}
.framed {
position: absolute;
top: 50%;
left: 50%;
width: 15rem;
margin-left: -7.5rem;
}
.logo {
margin-top: -9em;
cursor: default;
}
.form {
margin-top: -4.5em;
transition: 1s ease-in-out;
}
.input {
-moz-box-sizing: border-box;
box-sizing: border-box;
font-size: 1.125rem;
line-height: 3rem;
width: 100%;
height: 3rem;
color: #444;
background-color: rgba(255, 255, 255, .9);
border: 0;
border-top: 1px solid rgba(255, 255, 255, 0.7);
padding: 0 1rem;
font-family: 'Open Sans', sans-serif;
}
.input:focus {
outline: none;
}
.input--top {
border-radius: 0.5rem 0.5rem 0 0;
border-top: 0;
}
.input--submit {
background-color: rgba(92, 168, 214, 0.9);
color: #fff;
font-weight: bold;
cursor: pointer;
border-top: 0;
border-radius: 0 0 0.5rem 0.5rem;
margin-bottom: 1rem;
}
.text {
color: #fff;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
text-decoration: none;
}
.text--small {
opacity: 0.85;
font-size: 0.75rem;
cursor: pointer;
}
.text--small:hover {
opacity: 1;
}
.text--omega {
width: 200%;
margin: 0 0 1rem -50%;
font-size: 1.5rem;
line-height: 1.125;
font-weight: normal;
}
.text--centered {
display: block;
text-align: center;
}
.text--border-right {
border-right: 1px solid rgba(255, 255, 255, 0.5);
margin-right: 0.75rem;
padding-right: 0.75rem;
}
.legal {
position: absolute;
bottom: 1.125rem;
left: 1.125rem;
}
.photo-cred {
position: absolute;
right: 1.125rem;
bottom: 1.125rem;
}
.fullscreen-bg {
position: absolute;
height: 50vh;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: url(https://unsplash.it/1800/700?random.jpg) center;
background-size: cover;
}
#toggle--login:checked~.form--signup {
left: 200%;
visibility: hidden;
}
#toggle--signup:checked~.form--login {
left: -100%;
visibility: hidden;
}
#media (height:300px) {
.legal,
.photo-cred {
display: none
}
}
<input type="radio" checked id="toggle--login" name="toggle" class="ghost" />
<input type="radio" id="toggle--signup" name="toggle" class="ghost" />
<form class="form form--login framed">
<input type="email" placeholder="Email" class="input input--top" />
<input type="password" placeholder="Password" class="input" />
<input type="submit" value="Log in" class="input input--submit" />
<label for="toggle--signup" class="text text--small text--centered">New? <b>Sign up</b></label>
</form>
<form class="form form--signup framed">
<h2 class="text text--centered text--omega">Join the other <b>152.6 million</b> blogs and</br>share all that you love.</h2>
<input type="email" placeholder="Email" class="input input--top" />
<input type="password" placeholder="Password" class="input" />
<input type="text" placeholder="Username" class="input" />
<input type="submit" value="Sign up" class="input input--submit" />
<label for="toggle--login" class="text text--small text--centered">Not new? <b>Log in</b></label>
</form>
</div>
<div class="fullscreen-bg"></div>