password input shakes when I focus/unfocus on.username - css

When I focus/unfocus on password, no shaking happens, but when I focus/unfocus on username then the password shakes...
Why is that happening & how to stop that?
body {
background-color: royalblue; /*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 5%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid beige;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
top: 1px;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 2px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: -1px;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
/* transition: transform 1s 2s;*/
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username">
<input name="name" class="user-input" id="user" required>
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password">
<input name="name" class="pass-input" id="pass" required>
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>

Add height to both div containers, so they keep it when clicked on.
body {
background-color: royalblue; /*#f0f0f0;*/
}
label {
font-family: 'Montserrat', sans-serif;
font-size: 14px;
z-index: -1;
border: 0;
color: white;
position: relative;
}
.head {
color: white;
margin-left: 44%;
font-family: monospace;
font-size: 25px;
}
.username {
height:40px;
}
.password {
height:40px;
}
/*.content {
margin-top: 10%;
margin-left: 41%;
}*/
.password {
margin-top: 5%;
}
form {
position: relative;
}
input {
position: absolute;
font-family: 'Montserrat', sans-serif;
font-size: 15px;
background: transparent;
border: 0; /* BORDER yes/no */
border-bottom: 2px solid beige;
background: transparent;
outline: 0;
height: 25px;
width: 180px;
z-index: 1;
margin-top: 5px;
}
/*input:focus {
outline: 1;
}*/
label::after {
content: '';
position: absolute;
top: 1px;
left: 0;
width: 180px;
height: 25px;
border-radius: 2px;
transition: transform .3s;
}
label::after{
z-index: -1;
background: beige; /*#a86bf;*/
transform: scale3d(1, 0, 1);
transform-origin: 0% 0%;
}
input:focus {
border-radius: 2px;
}
input:focus + label::after,
input:valid + label::after {
transform: scale3d(1, -1.3, 1);
transition-timing-function: linear;
top: -1px;
}
span {
position: relative;
margin-top: -30px;
display: block;
padding: .6em 0;
padding-left: -5px;
transition: top .5s ease, font-size .5s ease;
/* transition: transform 1s 2s;*/
top: 0;
}
input:focus + label > span,
input:valid + label > span {
top: -20px;
font-size: 11px;
padding-bottom: 15px;
}
/* font-family: monospace;*/
/*transform: translate3d(0, -80%, 0); */
/* transition-timing-function: linear;*/
<p class="head">Sign In</p>
<form>
<div class="content">
<div class="username" >
<input name="name" class="user-input" id="user" required>
<label class="user-label" for="user"><span>Username</span></label>
</div>
<div class="password" >
<input name="name" class="pass-input" id="pass" required>
<label class="pass-label" for="pass"><span>Password</span></label>
</div>
</div>
</form>

What I think's happening is that your CSS is adding a small margin to the bottom of the <div class="username"> and this is causing your "shaking". The reason it's not happening when you click on the Password is because there's nothing under it.

Related

missing css to fix this toggle switch, z-index issue?

This codepen has a yes / no toggle. the Yes doesn't display after the toggle has moved over it, but the No works? What css will get the Yes to show up?
https://codepen.io/trynn/pen/NWPNMdE
input[type="radio"].toggle {
display: none;
& + label{
cursor: pointer;
min-width: 60px;
border-radius: 30px;
&:hover{
background: none;
}
&:after{
background: blue;
content: "";
height: 100%;
position: absolute;
z-index:-1;
border-radius: 30px;
top: 0;
transition: left 200ms cubic-bezier(0.77, 0, 0.175, 1);
width: 100%;
}
}
&.toggle-left + label {
border-right: 0;
color: #fff;
&:after{
left: 100%;
}
}
&.toggle-right + label{
margin-left: -5px;
color: #fff;
&:after{
left: -100%;
}
}
&:checked + label {
cursor: default;
color: #fff;
transition: color 200ms;
&:after{
left: 0;
}
}
}
You added 2 blue bubbles for toggle-left and toggle-right since you only needed one of them moving from one to another. For your case, in order to not go over the 'yes', you should remove the :after in toggle-right. Try this:
.toggle-switch-container {
position: relative;
line-height: 32px;
border-radius: 30px;
width: fit-content;
margin-left: auto;
margin-right: auto;
margin-bottom:25px;
background-color: rgba(0, 0, 0, 1);
z-index:1;
}
.btn{
display: inline-block;
padding: 10px;
position: relative;
text-align: center;
transition: background 600ms ease, color 600ms ease;
z-index:100;
}
input[type="radio"].toggle {
display: none;
& + label{
cursor: pointer;
min-width: 60px;
border-radius: 30px;
&:hover{
background: none;
}
}
&.toggle-left + label {
border-right: 0;
color: #fff;
&:after{
background: blue;
content: "";
height: 100%;
position: absolute;
z-index:-1;
border-radius: 30px;
top: 0;
transition: left 200ms cubic-bezier(0.77, 0, 0.175, 1);
width: 100%;
left: 100%;
}
}
&.toggle-right + label{
margin-left: -5px;
color: #fff;
}
&:checked + label {
cursor: default;
color: #fff;
transition: color 200ms;
&:after{
left: 0;
}
}
}
For a simple explanation why this works: for 2 elements having the same z-index, the last element comes in front of the other. Your 2 toggle buttons had the same z-index, so their :after, so the toggle-right:after comes in front of toggle-left blocking the 'yes'. By removing the :after of toggle-right, you removed the element blocking the 'yes' solving the problem.
I think you are looking for this
body {
background-color: #ddd;
}
/*Style main div and remove default checkbox*/
.switch {
position: relative;
width: 75px;
margin: 0 auto;
}
.switch-checkbox {
display: none;
}
/*Style words and oval switch */
.switch-labels {
display: block;
overflow: hidden;
cursor: pointer;
border-radius: 20px;
}
.switch-text {
display: block;
width: 200%;
margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.switch-text:before,
.switch-text:after {
float: left;
width: 50%;
line-height: 30px;
color: white;
box-sizing: border-box;
}
.switch-text:before {
content: "ON";
padding-left: 10px;
background-color: #E1F6FF;
color: #000000;
}
.switch-text:after {
content: "OFF";
padding-right: 10px;
background-color: #4D5585;
color: #FFFFFF;
text-align: right;
}
/*Style center dot*/
.switch-dot {
width: 30px;
height: 30px;
background: #FFFFFF;
position: absolute;
top: 0;
bottom: 0;
right: 41px;
margin-right: 5px;
border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.switch-dot:after{
content: "";
position: absolute;
width: 20px;
height: 20px;
background-size: cover;
background-image: url('http://www.free-icons-download.net/images/multiply-icon-27981.png');
margin: 5px 0 0 5px;
}
/*State changer*/
.switch-checkbox:checked+.switch-labels .switch-text {
margin-left: 0;
}
.switch-checkbox:checked+.switch-labels .switch-dot {
right: 0px;
margin-right: 0px;
}
<div class="switch">
<input type="checkbox" name="switch" class="switch-checkbox" id="myswitch" checked>
<label class="switch-labels" for="myswitch">
<span class="switch-text"></span>
<span class="switch-dot"></span>
</label>
</div>
Using 2 text as on and off
.toggle-label {
position: relative;
display: block;
width: 300px;
height: 80px;
margin-top: 8px;
border: 1px solid #808080;
margin: 200px auto;
}
.toggle-label input[type=checkbox] {
opacity: 0;
position: absolute;
width: 100%;
height: 100%;
}
.toggle-label input[type=checkbox]+.back {
position: absolute;
width: 100%;
height: 100%;
background: #ed1c24;
transition: background 150ms linear;
}
.toggle-label input[type=checkbox]:checked+.back {
background: #00a651; /*green*/
}
.toggle-label input[type=checkbox]+.back .toggle {
display: block;
position: absolute;
content: ' ';
background: #fff;
width: 50%;
height: 100%;
transition: margin 150ms linear;
border: 1px solid #808080;
border-radius: 0;
}
.toggle-label input[type=checkbox]:checked+.back .toggle {
margin-left: 150px;
}
.toggle-label .label {
display: block;
position: absolute;
width: 50%;
color: #000;
line-height: 80px;
text-align: center;
font-size: 2em;
}
.toggle-label .label.on { left: 0px; }
.toggle-label .label.off { right: 0px; }
.toggle-label input[type=checkbox]:checked+.back .label.on {
color: #fff;
}
.toggle-label input[type=checkbox]+.back .label.off {
color: #000;
}
.toggle-label input[type=checkbox]:checked+.back .label.off {
color: #000;
}
<label class='toggle-label'>
<input type='checkbox'/>
<span class='back'>
<span class='toggle'></span>
<span class='label on'>ON</span>
<span class='label off'>OFF</span>
</span>
</label>

Issues with styling toggle switch in css/sass

I am having some issues I cannot seem to figure out with styling a toggle switch as required. I currently have it like this:
It however needs to look like this:
Here is my HTML:
<label class="switch"><input #handlingUnitAdvancedOptionsCheckBox id="handlingUnitAdvancedOptionsCheckBox" type="checkbox" [checked]="handlingModel.advancedOptions"
(change)="handlingUnitAdvancedOptionsToggle(handlingUnitAdvancedOptionsCheckBox.checked)" />
<span class="slider round"></span>
</label>
Here is my css:
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 50px!important;
height: 24px!important;
cursor: pointer;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
display: block;
width: 22px!important;
height: 22px!important;
margin: 1px;
background: #fff;
position: absolute;
top: 0;
bottom: 0;
right: 26px;
border-radius: 20px;
transition: margin .3s ease-in 0s;
transition-property: margin;
transition-duration: 0.3s;
transition-timing-function: ease-in;
transition-delay: 0s;
box-shadow: 1px 2px 7px #444;
}
input:checked + .slider {
background-color: #236093;
}
input:focus + .slider {
box-shadow: 0 0 1px #236093;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 20px;
}
.slider.round:before {
border-radius: 50%;
}
Not sure where I am going wrong here or what I need to adjust. I have tried changing the transform and the padding but I cannot seem to get it right.
You can use the following solution:
.switch {
cursor: pointer;
display: inline-block;
height: 24px;
position: relative;
width: 50px;
overflow:hidden;
}
.switch input {
height: 0;
opacity: 0;
width: 0;
}
.slider {
background: #ccc;
bottom: 0;
cursor: pointer;
display: block;
left: 0;
position: absolute;
right: 0;
top: 0;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
background: #fff;
border-radius: 50%;
bottom: 1px;
box-shadow: 3px 0px 7px #444;
content: "";
display: block;
height: 22px;
left: 1px;
position: absolute;
right: 50px;
top: 1px;
width: 22px;
transition-property: all;
transition-duration: .6s;
}
input:checked + .slider {
background: #236093;
}
input:checked + .slider:before {
box-shadow: -3px 0px 7px #002551;
left: calc(100% - 23px); /** width of .slider:before + 1px */
}
.slider.round {
border-radius: 24px;
}
<label class="switch">
<input #handlingUnitAdvancedOptionsCheckBox id="handlingUnitAdvancedOptionsCheckBox" type="checkbox" [checked]="handlingModel.advancedOptions"
(change)="handlingUnitAdvancedOptionsToggle(handlingUnitAdvancedOptionsCheckBox.checked)" />
<span class="slider round"></span>
</label>

CSS Popup With Button to Close

I am Using CSS for controlling and showing POPUP on my page, everything works fine, but i want Okay button to close popup instead of close it by clicking on cross button on right top corner . is there any way for doing this in css. or what can i do alternative for this.
.box {
width: 40%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.button {
font-size: 1em;
padding: 10px;
color: #fff;
border: 2px solid #06D85F;
border-radius: 20px/50px;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease-out;
}
.button:hover {
background: #06D85F;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 0.2s;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
/*Let's make it appear when the page loads*/
.overlay:target:before {
display: none;
}
.overlay:before {
content:"";
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
background: rgba(0, 0, 0, 0.6);
position: fixed;
z-index: 9;
}
.overlay .popup {
background: #fff;
border-radius: 5px;
width: 64%;
position: fixed;
top: 25%;
left: 18%;
padding: 25px;
margin: 70px auto;
z-index: 10;
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
}
.overlay:target .popup {
top: -100%;
left: -100%;
}
#media screen and (max-width: 768px){
.box{
width: 70%;
}
.overlay .popup{
width: 70%;
left: 15%;
}
}
<!--popup starts-->
<div id="popup1" class="overlay">
<div class="popup">
<h3 style="margin-bottom: 13px; text-align:center; color:red;">Your Application Id : <?php echo $appid;?></h3>
<a class="close" href="#popup1">×</a>
<div class="content">
Thank you <span style="text-transform:uppercase; font-weight:600;"><?php echo $firstname;?> <?php echo $middlename;?> <?php echo $surname;?></span> for registring for e-visa service.there is more text.
</div>
</div>
</div>
<!--popup end-->
.... or you could just use an anchor styled as a button
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
display:block;
border:1px solid darkblue;
text-align:center;
background: steelblue;
color:white;
border-radius:5px;
padding:5px;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
/*Let's make it appear when the page loads*/
.overlay:target:before {
display: none;
}
.overlay:before {
content:"";
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
background: rgba(0, 0, 0, 0.6);
position: fixed;
z-index: 9;
}
.overlay .popup {
background: #fff;
border-radius: 5px;
width: 64%;
position: fixed;
top: 0;
left: 18%;
padding: 25px;
margin: 70px auto;
z-index: 10;
-webkit-transition: all 0.6s ease-in-out;
-moz-transition: all 0.6s ease-in-out;
transition: all 0.6s ease-in-out;
}
.overlay:target .popup {
top: -100%;
left: -100%;
}
#media screen and (max-width: 768px){
.box{
width: 70%;
}
.overlay .popup{
width: 70%;
left: 15%;
}
}
<!--popup starts-->
<div id="popup1" class="overlay">
<div class="popup">
<h3 style="margin-bottom: 13px; text-align:center; color:red;">Your Application Id : <?php echo $appid;?></h3>
<div class="content">
Thank you <span style="text-transform:uppercase; font-weight:600;"><?php echo $firstname;?> <?php echo $middlename;?> <?php echo $surname;?></span> for registring for e-visa service.there is more text.
</div>
<a class="close" href="#popup1">OK</a>
</div>
</div>
<!--popup end-->

How to create a form with its place holders animating?

I am trying to create a form similar to SEND GRID
I am not sure what technology they have used. Google gave me some information on MaterialsCSS. Is it good to use?
Can any one guide me on this?
Pure CSS3 Will help you a lot !
.input {
position: relative;
z-index: 1;
display: inline-block;
margin: 1em;
max-width: 350px;
width: calc(100% - 2em);
vertical-align: top;
}
.input__field {
position: relative;
display: block;
float: right;
padding: 0.8em;
width: 60%;
border: none;
border-radius: 0;
background: #f0f0f0;
color: #aaa;
font-weight: 400;
font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-appearance: none;
/* for box shadows to show on iOS */
}
.input__field:focus {
outline: none;
}
.input__label {
display: inline-block;
float: right;
padding: 0 1em;
width: 40%;
color: #696969;
font-weight: bold;
font-size: 70.25%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.input__label-content {
position: relative;
display: block;
padding: 1.6em 0;
width: 100%;
}
.graphic {
position: absolute;
top: 0;
left: 0;
fill: none;
}
.icon {
color: #ddd;
font-size: 150%;
}
/* Nariko */
.input--nariko {
overflow: hidden;
padding-top: 2em;
}
.input__field--nariko {
width: 100%;
background: transparent;
opacity: 0;
padding: 0.35em;
z-index: 100;
color: #f18292;
}
.input__label--nariko {
width: 100%;
bottom: 0;
position: absolute;
pointer-events: none;
text-align: left;
color: #8E9191;
padding: 0 0.5em;
}
.input__label--nariko::before {
content: '';
position: absolute;
width: 100%;
height: 4em;
top: 100%;
left: 0;
background: #fff;
border-top: 4px solid #9B9F9F;
-webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0);
-webkit-transition: -webkit-transform 0.4s;
transition: transform 0.4s;
-webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
}
.input__label-content--nariko {
padding: 0.5em 0;
-webkit-transform-origin: 0% 100%;
transform-origin: 0% 100%;
-webkit-transition: -webkit-transform 0.4s, color 0.4s;
transition: transform 0.4s, color 0.4s;
-webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);
}
.input__field--nariko:focus,
.input--filled .input__field--nariko {
cursor: text;
opacity: 1;
-webkit-transition: opacity 0s 0.4s;
transition: opacity 0s 0.4s;
}
.input__field--nariko:focus + .input__label--nariko::before,
.input--filled .input__label--nariko::before {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
-webkit-transform: translate3d(0, -3.3em, 0);
transform: translate3d(0, -3.3em, 0);
}
.input__field--nariko:focus + .input__label--nariko .input__label-content--nariko,
.input--filled .input__label-content--nariko {
color: #6B6E6E;
-webkit-transform: translate3d(0, -3.3em, 0) scale3d(0.81, 0.81, 1);
transform: translate3d(0, -3.3em, 0) scale3d(0.81, 0.81, 1);
}
<section class="content bgcolor-7">
<h2>Input Custom Design</h2>
<span class="input input--nariko">
<input class="input__field input__field--nariko" type="text" id="input-20" />
<label class="input__label input__label--nariko" for="input-20">
<span class="input__label-content input__label-content--nariko">Username</span>
</label>
</span>
<span class="input input--nariko">
<input class="input__field input__field--nariko" type="text" id="input-21" />
<label class="input__label input__label--nariko" for="input-21">
<span class="input__label-content input__label-content--nariko">Website</span>
</label>
</span>
<span class="input input--nariko">
<input class="input__field input__field--nariko" type="text" id="input-22" />
<label class="input__label input__label--nariko" for="input-22">
<span class="input__label-content input__label-content--nariko">Invitation Code</span>
</label>
</span>
</section>
Just HTML5, CSS3 and Modern browser Try This & edit as you can......

Placeholder position when input has text

How to do placeholder styling when Input Text are focus, the placeholder are still visible and the font-size become smaller. For example like this:
I only need webkit support. Does webkit support such thing?
.input {
width: 200px;
height: 35px;
outline:0;
padding:0 10px;
}
.label { position: absolute;
pointer-events: none;
left: 20px;
top: 18px;
transition: 0.2s ease all;
}
input:focus ~ .label,
input:not(:focus):valid ~ .label{
top: 10px;
bottom: 5px;
left: 20px;
font-size: 12px;
}
<div>
<input type="text" class="input" required/>
<span class="label">Company Name</span>
</div>
You need to use a label element and modify it accordingly. Try this:
function fillClass() {
if ($(this).val() != '')
$(this).parent().addClass('input--filled');
else
$(this).parent().removeClass('input--filled');
}
$(".sign-in-input").focusout(fillClass);
.sign-in-input-ctr {
width: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: 25px;
position: relative;
margin-top: 50px;
}
.sign-in-input {
width: 100%;
border: 2px solid transparent;
-webkit-transition: all 0.3s;
transition: all 0.3s;
height: 38px;
background-color: #fff;
outline: none;
border: 1px solid rgba(73, 73, 73, 0.2);
border-radius: 2px;
padding-left: 10px;
}
.sign-in-input:focus,
.input--filled .sign-in-input {
background-color: transparent;
border: 1px solid #a09e9e;
}
.sign-in-label {
width: 100%;
font-size: 12px;
position: absolute;
top: -18px;
pointer-events: none;
overflow: hidden;
padding: 0 15px;
left: 0;
-webkit-transform: translate3d(0, 30px, 0);
transform: translate3d(0, 30px, 0);
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
}
.sign-in-input:focus+.sign-in-label,
.input--filled .sign-in-label {
-webkit-transform: translate3d(-15px, 0, 0);
transform: translate3d(-15px, 0, 0);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="sign-in-input-ctr">
<input class="sign-in-input" type="text" name="email">
<label class="sign-in-label" for="signin-email"><span class="input-label-content">Email</span>
</label>
</div>
//------ contact us dropdown list
$(document).ready(function(){
$( ".form-group .form-control" ).focus(function() {
$(this).parent().addClass('inputFous');
}).blur(function() {
if($.trim($(this).val()) == '')
{
$(this).parent().removeClass('inputFous');
}
});
});
I think there is no webkit support for this, please check this code which will help you:- Jsfiddle

Resources