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.
Related
I want to show the spinner/loader inside the input tag and loader's position should not change based on screen size.
My complete code :
<html>
<style>
input[type=text]{
position: relative;
width: 30%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.loader {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border: 4px solid transparent;
border-radius: 50% ;
border-top: 5px solid #3498db;
width: 25px;
height: 25px;
animation: spinner 1s ease infinite;
}
#keyframes spinner {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<body>
<div>
<label for="fname">First Name</label>
<input type="text" name="firstname" class="loader" placeholder="Your name"/>
</div>
</body>
</html>
But all I get is a spinning input field instead of loader inside the field.
You should add some animation resources to your input. You can try:
<html>
<style>
input[type=text]{
position: relative;
width: 30%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.loading {
background-color: #ffffff;
background-image: url("https://i.gifer.com/ZZ5H.gif");
background-size: 25px 25px;
background-position:right center;
background-repeat: no-repeat;
}
</style>
<body>
<div>
<label for="fname">First Name</label>
<input type="text" name="firstname" class="loading" placeholder="Your name"/>
</div>
</body>
I want to place a button inside my input exactly like this:
So far I have the input but I'm unable to find a solution to place the button properly.
.realoutercontainer {
padding: 10% 0;
position:relative;
}
.outercontainer {
direction: rtl;
text-align: center;
position: relative;
z-index: 1;
max-width: 1040px;
margin: 0 auto;
width: 100%;
box-sizing: border-box;
border-bottom: 2px solid rgba(207,215,223,.25);
position: relative;
background-color: #fff;
border-radius: 30px;
padding: 30px 40px 10px 40px;
-webkit-box-shadow: 0 30px 60px -12px rgba(50,50,93,.25),0 18px 36px -18px rgba(0,0,0,.3);
box-shadow: 0 30px 60px -12px rgba(50,50,93,.25),0 18px 36px -18px rgba(0,0,0,.3);
box-sizing: border-box;
color: #6c6770;
font-family: "Vazir";
}
.realoutercontainer.settings{
padding: 2% 0;
}
.settings .outercontainer {
max-width: 100%;
width: 94%;
height: 600px;
padding: 100px;
padding-top: 50px;
}
.settings-input {
margin: 50px 0;
display: flex;
justify-content: center;
}
.settings-input input {
display: inline-block;
direction: ltr;
text-align: center;
outline: none;
width: 300px;
background: #ededed;
color: #743db0;
padding: 5px 5px;
border-radius: 3px;
border: solid 1px;
border-color: transparent;
transition: all 0.3s ease-in;
}
.settings-input input:focus {
color: #8e5bc5;
background: #fff;
border-color: #e7572c;
}
.settings-input .input-field {
display: flex;
flex-direction: column ;
}
.settings-input .uname{
align-self: flex-start;
margin-bottom: 3px;
}
<div class="realoutercontainer settings">
<div class="outercontainer">
<div class="settings-input">
<div class="input-field">
<div for="fname" class="uname">نام کاربری :</div>
<div><input type="text" id="fname" name="fname" placeholder="user_1252442"/></div>
<button type="submit">ویرایش</button>
</div>
</div>
</div>
</div>
div,
form,
input {
position: relative;
}
.container {
width: 400px;
display: flex;
padding: 0.5rem;
align-items: center;
background-color: coral;
}
input {
width: 100%;
padding: 1rem;
border: 1px solid black;
}
button {
position: absolute;
right: 1rem;
}
<form>
<label> نام کاربری : </label>
<br />
<div class="container">
<input type="text" placeholder="Some Text..." />
<button type="submit"> Submit </button>
</div>
</form>
You can change the styles or whatever you want accordingly. I showed how its done.
Here goes, follow the code, I hope it helps you.
It is not styled, it is in raw form.
input {
position: absolute;
height: 2.3em;
}
.group-wrapper {
width: 50em;
display: flex;
align-items: center;
}
.content {
padding-left: 7em;
background: #EDEDED;
border: none;
border-radius: 0.2em;
}
.uname {
margin:0 9em 0.5em;
display: inline-block;
-moz-transform: scale(-1, 1);
-webkit-transform: scale(-1, 1);
transform: scale(-1, 1);
}
button {
position: relative;
justify-content: start;
color: #E1E5ED;
background: #ED1C24;
padding: 0.4em;
margin-left: 0.5em;
border: none;
}
<form>
<label for="user" class="uname">نام کاربری :</label>
<div class="group-wrapper">
<input id="user" class="content" type="text" placeholder="user_1252442" />
<button type="submit">ویرایش</button>
</div>
</form>
Shamelessly borrowing from #Kunal, this version puts the button on the left as desired:
div,
form,
input {
position: relative;
}
.container {
width: 400px;
display: flex;
padding: 0.5rem;
align-items: center;
}
input {
width: 100%;
padding: 1rem;
padding-left: 100px;
border: 1px solid black;
}
button {
position: absolute;
left: 1rem;
}
<form>
<label> نام کاربری : </label>
<br />
<div class="container">
<input type="text" placeholder="Some Text..." />
<button> My button </button>
</div>
</form>
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%;
}
I tried customizing a file upload button using css.
<label class="custom-file-input">
<input type="file" name="file" id="videofile" /> <!--class="dropzone"-->
</label>
Full Code in jsfiddle. https://jsfiddle.net/2e7dLvoy/
How can i show the file name that is choosen just like a normal file upload button?
Use this
HTML:
<div class="form-group upload_btn">
<div class="fileUpload pull-left">
<span>Browse</span>
<input type="file" class="upload " id="uploadBtn">
</div>
<input disabled="disabled" class="input pull-left" placeholder="Upload your resume" id="uploadFile">
</div>
Css:
.form-group.upload_btn {
overflow: hidden;
margin-bottom: 20px;
}
.fileUpload {
background: #e1e1e1 none repeat scroll 0 0;
color: #626262;
display: inline-block;
font-size: 18px;
font-weight: 300;
overflow: hidden;
padding: 5.5px 10px;
position: relative;
}
.pull-left {
float: left;
}
.fileUpload input.upload {
cursor: pointer;
font-size: 20px;
left: 0;
margin: 0;
opacity: 0;
padding: 0;
position: absolute;
top: 0;
}
.upload_btn .input {
width: 79%;
}
.input {
border: 0px;
padding: 8px;
box-shadow: none;
background-color: #fff;
}
Js:
document.getElementById("uploadBtn").onchange = function () {
document.getElementById("uploadFile").value = this.value;
};
Here is the jsfiddle link
try this:
fiddle with jquery: https://jsfiddle.net/2e7dLvoy/4/
HTML
<label class="custom-file-input">
<input type="file" name="file" id="videofile" /> <!--class="dropzone"-->
<p id="selectedFile"></p>
</label>
CSS
.custom-file-input {
display: inline-block;
position: relative;
color: #533e00;
}
.custom-file-input input {
visibility: hidden;
width: 100px
}
.custom-file-input:before {
content: 'Drag & Drop';
display: block;
background: -webkit-linear-gradient( -180deg, #ffdc73, #febf01);
background: -o-linear-gradient( -180deg, #ffdc73, #febf01);
background: -moz-linear-gradient( -180deg, #ffdc73, #febf01);
background: linear-gradient( -180deg, #ffdc73, #febf01);
border: 3px solid #dca602;
border-radius: 10px;
padding: 5px 0px;
outline: none;
white-space: nowrap;
cursor: pointer;
text-shadow: 1px 1px rgba(255,255,255,0.7);
font-weight: bold;
text-align: center;
font-size: 10pt;
position: absolute;
left: 0;
font-size: 12px;
}
.custom-file-input:hover:before {
border-color: #febf01;
}
.custom-file-input:active:before {
background: #febf01;
}
p {
float: left;
margin: -5% 14% 0% 32%;
}
jQuery
$('input[type=file]').change(function(e){
$in=$(this);
$('#selectedFile').html($in.val());
});
I am trying to get my search box to work but the box is showing on top of my and the css i gave for my fieldset. it looks like the original text input box is on top of the modified fieldset text box (which i want to use for my wesite). the fieldset box is longer ans perfect but i cannot type into that box because the original small box is on top of the fieldset css. thank you
index:
<form id="search-form" action="/properties/search" method="get">
<fieldset>
<input type ="text "name="q" placeholder="Search for a Website" autocomplete="off">
<button type="button" data-hasqtip="5" oldtitle="search" title aria- describedby="qtip-5"> </button>
</fieldset>
</form>
css:
#search-form {
display: block;
margin-top: 9px;
float: left;
}
#search-form fieldset {
position: relative;
width: 425px;
height: 22px;
padding: 0;
background-color: #fdfdfd;
border: 1px solid #ced8dd;
}
#search-form input[type="text"] {
position: relative;
font-size: .8125em;
line-height: 1.3846153846153846;
padding: 0;
margin: 2px 0 0 5px;
border-width: 0;
width: 380px;
}
search-form button {
position: absolute;
right: 0;
width: 18px;
height: 16px;
padding: 0;
margin: 3px 3px 0 0;
border: 0;
border-left: 1px solid #ced8dd;
background-color: #fdfdfd;
background-repeat: no-repeat;
background-image: url("http://images.househappy.org/icon_sprite_1x_v14.png");
background-position: -10px -22px;
}
It's been said in the comments, but really all you need to do is clean up your code.
Have a fiddle!
HTML
<form id="search-form" action="/properties/search" method="get">
<fieldset>
<input type="text" name="q" placeholder="Search for a Website" autocomplete="off" />
<button type="button" data-hasqtip="5" oldtitle="search"> </button>
</fieldset>
</form>
CSS
#search-form {
display: block;
margin-top: 9px;
float: left;
}
#search-form fieldset {
position: relative;
width: 425px;
height: 22px;
padding: 0;
background-color: #fdfdfd;
border: 1px solid #ced8dd;
}
#search-form input[type="text"] {
position: relative;
font-size: .8125em;
line-height: 1.3846153846153846;
padding: 0;
margin: 2px 0 0 5px;
border-width: 0;
width: 380px;
}
#search-form button {
position: absolute;
right: 0;
width: 18px;
height: 16px;
padding: 0;
margin: 3px 3px 0 0;
border: 0;
border-left: 1px solid #ced8dd;
background-color: #fdfdfd;
background-repeat: no-repeat;
background-image: url("http://images.househappy.org/icon_sprite_1x_v14.png");
background-position: -10px -22px;
}