How to create a form with its place holders animating? - css

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

Related

How can I apply this style to my slideshow?

I would like to apply a different style to my slideshow. Therefore I found one on the internet, which corresponds to my wishes. I tried to insert it, but unfortunately it doesn't work at all. Do you have any idea how I merge CSS code with my slideshow?
slideshow.js
import React from "react";
import { Gallery, GalleryImage } from "react-gesture-gallery";
const images = [
"https://img-9gag-fun.9cache.com/photo/amBjg8y_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/abYPGB8_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/abYPgY8_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/az9NeXq_700bwp.webp",
"https://img-9gag-fun.9cache.com/photo/aPYNZ4Q_700bwp.webp"
];
function Slider() {
const [index, setIndex] = React.useState(0);
return (
<Gallery
style={{
position: "relative",
background: "white",
height: "40vh",
width: "180w"
}}
index={index}
onRequestChange={i => {
setIndex(i);
}}
>
{images.map(image => (
<GalleryImage objectFit="contain" key={image} src={image} />
))}
</Gallery>
);
}
export default Slider;
current css
*,
::after,
::before {
box-sizing: content-box;
}
element.style {
background-color: black;
}
body {
padding: 0px;
}
.App {
font-family: sans-serif;
}
.vertical-timeline-element-icon,
.bounce-in {
box-shadow: 0px 0px transparent;
text-align: center;
margin-bottom: 50px;
}
.adventure {
width: 400px;
}
.vertical-timeline-element-date {
text-align: left;
width: 80%;
}
.img_logo {
width: 60px;
height: 60px;
border-radius: 50%;
}
#media only screen and (min-width: 1170px) {
.vertical-timeline.vertical-timeline--two-columns:before {
left: 50%;
margin-left: -2px;
background: #ddd;
}
}
#media only screen and (max-width: 1172px) {
.vertical-timeline-element-content {
margin-left: 8%;
}
.img_logo {
width: 40px;
height: 40px;
}
}
#media only screen and (max-width: 772px) {
.vertical-timeline-element-content {
margin-left: 14%;
}
}
.loader {
border: 10px solid #bebebe;
border-top: 10px solid #000000;
border-radius: 50%;
width: 70px;
height: 70px;
animation: spin 1s linear infinite;
margin: auto;
margin-top: 20%;
}
.Buttons {
margin-top: 200px;
}
.btn1 {
background-color: #d23c21;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn2 {
background-color: #3f66cb;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn3 {
background-color: #f69a1d;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px;
cursor: pointer;
border-radius: 6px;
}
.btn4 {
background-color: #4caf50;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
margin: 4px 2px;
cursor: pointer;
border-radius: 6px;
}
.App {
font-family: sans-serif;
text-align: center;
color: black;
}
.home {
margin-top: 10%;
text-align: center;
}
.header {
margin-top: 10%;
text-align: center;
}
.Text {
text-align: center;
width: 50%;
font-size: 100%;
margin: 0 auto;
display: flex;
}
.timeline-badge.primary {
background-color: #ffa500 !important;
}
.timeline-badge.success {
background-color: #ffa500 !important;
}
.timeline-badge.warning {
background-color: #ffa500 !important;
}
.timeline-badge.danger {
background-color: #ffa500 !important;
}
.timeline-badge.info {
background-color: #ffa500 !important;
}
.timeline-title {
margin-top: 0;
color: inherit;
}
.timeline-body > p {
margin-bottom: 0;
width: 80px;
font-size: 22px;
align: center;
text-align: center;
margin-left: 40px;
}
.timeline-body > p + p {
margin-top: 5px;
width: 22px;
text-align: center;
}
.same {
font-size: 20px;
}
.home {
margin-top: 10%;
text-align: center;
}
.header {
margin-top: 10%;
text-align: center;
}
.Text {
text-align: center;
width: 50%;
font-size: 100%;
margin: 0 auto;
display: flex;
}
.Logo {
width: 50%;
}
.event {
display: flex;
position: absolute;
width: 100%;
margin-top: -60px;
transition: background-color 1s ease-in;
height: 700px;
}
.Videotext {
text-align: center;
position: relative;
height: 100%;
width: 50%;
font-size: 100%;
margin-top: 0;
margin-left: 2%;
display: 0;
}
.Video {
width: ´100%;
height: 20%;
margin-bottom: 12%;
background-color: "black";
display: block;
float: left;
transition: width 0.8s ease-out, height 0.3s ease-out;
}
.arrow {
width: 0px;
height: 0px;
position: flex;
border: 50px solid transparent;
border-top-color: orange;
margin: 0;
margin-left: -20px;
padding: 0;
float: left;
margin-top: 75px;
display: 0;
animation-name: meine-animation;
animation-duration: 1s;
animation-iteration-count: infinite;
}
#keyframes meine-animation {
0%,
100% {
border-top-color: orange;
}
50% {
border-top-color: white;
}
75% {
border-top-color: orange;
}
}
.arrow.left {
transform: rotate(90deg) translate(0px, 25px);
-webkit-transform: rotate(90deg) translate(0px, 0px);
-moz-transform: rotate(180deg) translate(0px, 25px);
-o-transform: rotate(180deg) translate(0px, 25px);
-ms-transform: rotate(180deg) translate(0px, 25px) translate(0px, 25px);
}
#boxi {
margin-top: 200px;
}
#animation {
color: orange;
padding: 0px;
position: absolute;
margin-top: 100px;
margin-left: -10px;
}
.slider {
display: block;
margin-left: 50%;
margin-top: 10%;
display: flex;
border-color: rgb(0, 108, 197);
border-width: 5px;
border-style: solid;
}
#media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
.slider {
display: block;
width: 130px;
height: 130px;
display: flex;
border-color: rgb(0, 108, 197);
border-width: 5px;
border-style: solid;
}
}
style i want to insert.css
body {
background:url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/low_contrast_linen.png) repeat;
-webkit-font-smoothing: subpixel-antialiased;
background-color: rgb(243, 243, 243);
}
#warp {
width: 90%;
max-width: 800px;
background: #595959;
margin: 30px auto;
overflow: hidden;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0 3px 5px rgba(0, 0, 0, 0.75);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
ul#gallery-container {
position: relative;
width: 100%;
max-width: 800px;
height: auto;
padding: 52% 0 10px;
margin: 0;
text-align: center;
display: block;
}
li.gallery-item {display: inline-block;width: 10%;cursor:pointer;*display:inline;}
img.gallery-preview{
background: white;
margin: 0;
padding: 5% 5% 15%;
*padding: 2px 2px 10px;
position: relative;
top: 0;
width: 85%;
height: auto;
max-height: 45px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
overflow: hidden;
-webkit-transition: all 0.3s ease-out .2s;
-moz-transition: all 0.3s ease-out .2s;
-o-transition: all 0.3s ease-out .2s;
transition: all 0.3s ease-out .2s;
}
ul#gallery-container:hover li img.gallery-preview{opacity: 0.5;-webkit-filter:blur(2px) grayscale(0.5); }
ul#gallery-container:hover li:hover img.gallery-preview{opacity: 1;-webkit-filter:blur(0px) grayscale(0); }
input.gallery-selector:checked ~ label.gallery-label>img.gallery-preview,
ul#gallery-container:hover li:hover img.gallery-preview:hover{
z-index: 5;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.75);
-webkit-transform: scale(1.25);
-moz-transform: scale(1.25);
-o-transform: scale(1.25);
transform: scale(1.25);
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
ul#gallery-container:hover li:hover img.gallery-preview:hover {z-index: 20;}
input.gallery-selector:checked ~ label.gallery-label>img.gallery-preview{background: #333}
input.gallery-selector:checked ~ label.gallery-label:before{
content: " ";
position: relative;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 20px solid #333;
top: -30px;
}
img.gallery-fullsize {
position: absolute;
top: 0px;
left: 0px;
display: block;
width: 100%;
height: auto;
z-index: -1;
opacity: 0;
-webkit-transform: scale(0.25);
-moz-transform: scale(0.25);
-o-transform: scale(0.25);
transform: scale(0.25);
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
ul#gallery-container:hover li.gallery-item:active img.gallery-fullsize{
z-index: 50;
opacity: 0.75;
-webkit-filter:blur(10px) grayscale(1);
border-radius: 10%;
-webkit-border-radius: 10%;
-moz-border-radius: 10%;
-webkit-transform-origin: bottom center;
-moz-transform-origin: bottom center;
-o-transform-origin: bottom center;
transform-origin: bottom center;
-webkit-transition: all 0.3s ease-out .2s;
-moz-transition: all 0.3s ease-out .2s;
-o-transition: all 0.3s ease-out .2s;
transition: all 0.3s ease-out .2s;
}
ul#gallery-container:hover li:hover input.gallery-selector:checked ~ img.gallery-fullsize{z-index: 10;opacity: 1;border-radius: 0;-moz-border-radius: 0;-webkit-border-radius: 0;}
input.gallery-selector:checked ~ img.gallery-fullsize {
display: block;
opacity: 1;
z-index: 10;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
-webkit-transform-origin: top center;
-moz-transform-origin: top center;
-o-transform-origin: top center;
transform-origin: top center;
-webkit-transition: all .2s ease-in .3s;
-moz-transition: all .2s ease-in .3s;
-o-transition: all .2s ease-in .3s;
transition: all .2s ease-in .3s;
}
input.gallery-selector {display: none;}
label.gallery-label {cursor: pointer;}
html from style i want to insert.html
<div id="warp">
<ul id="gallery-container">
<li class="gallery-item">
<input checked="checked" type="radio" name="gallery-list" class="gallery-selector" value="1.jpg" id="gallery-item1" />
<img src="http://lorempixel.com/400/200/sports" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item1" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="2.jpg" id="gallery-item2" />
<img src="http://lorempixel.com/400/200/sports/1" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item2" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/1" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="3.jpg" id="gallery-item3" />
<img src="http://lorempixel.com/400/200/sports/2" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item3" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/2" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="4.jpg" id="gallery-item4" />
<img src="http://lorempixel.com/400/200/sports/3" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item4" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/3" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="5.jpg" id="gallery-item5" />
<img src="http://lorempixel.com/400/200/sports/4" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item5" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/4" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="6.jpg" id="gallery-item6" />
<img src="http://lorempixel.com/400/200/sports/5" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item6" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/5" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
<li class="gallery-item">
<input type="radio" name="gallery-list" class="gallery-selector" value="7.jpg" id="gallery-item7" />
<img src="http://lorempixel.com/400/200/sports/6" class="gallery-fullsize" alt="location bateau 135ch" />
<label for="gallery-item7" class="gallery-label">
<img src="http://lorempixel.com/76/50/sports/6" class="gallery-preview" alt="location bateau 135ch"/>
</label>
</li>
</ul>
</div>
You'll need to create a css file and import it into the component. to set a classname in the JSX pass a className prop with a string.
example css file
.Class {
opacity: 1;
}
example render method from component
import './example.css'
render(){
<div className="Class">something</div>
}
The full documentation can be found here!

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>

password input shakes when I focus/unfocus on.username

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.

position:fixed moves on mobile scroll

I'm working on a website where on certain pages I want to have a fixed bar on the top of the page. On mobile this functions but when the finger is released from screen the bar moves away from the screen.
I've been using position:fixed;, top:0; and display:block;
Is there any way to fix this?
I've been twisting my brains around it for the last couple of days but can't seem to get it working.
[edit; In this
/* Basic CSS */
#offcanvas-menu {
z-index: 99999;
}
.banner {
position: fixed;
padding: 0;
overflow: hidden;
z-index: auto;
border-bottom-width: 0.13vw;
border-color: #000000;
border-bottom-style: solid;
}
.banner_inner {
width: 100%;
white-space: nowrap;
margin-bottom: 0;
margin-top: 0.3%;
cursor: pointer;
}
.banner {
bottom: 0;
left: 0;
width: 100vw;
background-color: white;
translateY(100%);
transform-origin: left bottom;
z-index: 102;
cursor: pointer;
}
/* main text in bar */
#banner-inner {
margin-left: 1.5%;
margin-top: 1.5%;
min-height: 144px;
position: relative;
}
#banner-row-1 {
width: 15vw;
margin-right: 1.5%;
display: inline-block;
position: absolute;
}
#banner-row-2 {
width: 15vw;
margin-right: 1.5%;
position: absolute;
display: inline-block;
left: 17.7vw;
}
#banner-row-3 {
width: 46.02vw;
margin-right: 1.5%;
position: absolute;
display: inline-block;
left: 34.18740849194729vw;
}
#banner-row-3 p6 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
}
a4 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
}
a5 {
font-family: helvetica, sans-serif;
font-weight: 300;
color: black;
font-size: 1.39vw;
line-height: 1.2;
margin-left: 5%;
}
#banner h4 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
margin-left: 1.5%;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
width: 31.5vw;
}
#banner h5 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
left: 34.18740849194729vw;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
margin-left: 1.5%;
width: 46.02vw;
}
#banner h6 {
font-family: helvetica, sans-serif;
color: #000000;
font-size: 3.2vw;
letter-spacing: 0em;
line-height: 1.2;
font-weight: 300;
text-align: left;
display: inline-block;
left: 34.18740849194729vw;
margin-top: 1.2vw;
margin-bottom: 1.2vw;
margin-left: 1.5%;
width: 15.1vw;
}
/* left */
nav#offcanvas-menu {
/* Full screen nav menu */
width: 100vw;
height: 29.5vw;
/* this is for browsers that don't support CSS3 translate3d */
-moz-transform: translate3d(0, -23.3vw, 0);
-webkit-transform: translate3d(0, -23.3vw, 0);
transform: translate3d(0, -23.3vw, 0);
}
nav#offcanvas-menu {
left: 0vw;
}
/* off canvas sidebar left right */
div#main-region {
position: relative;
width: 100%;
-moz-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-moz-transition: -moz-transform 0.5s;
/* transition settings */
-webkit-transition: -webkit-transform 0.5s;
transition: transform 0.5s;
}
/*SIDEBAR LEFT*/
input[type="checkbox"]#togglebox {
/* checkbox used to toggle menu state */
position: absolute;
left: 0;
top: 0;
visibility: hidden;
}
nav#offcanvas-menu label#closex {
/* Large x close button inside nav */
width: 100vw;
height: 100vh;
overflow: hidden;
display: block;
position: absolute;
cursor: pointer;
text-indent: -10000px;
line-height: 1.1;
z-index: 10;
top: 0;
right: 0;
}
input[type="checkbox"]#togglebox:checked~nav#offcanvas-menu {
/* nav state when corresponding checkbox is checked */
-moz-transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
-moz-transition-delay: 0s;
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
nav#offcanvas-menu {
top: 0;
z-index: 104;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: white;
display: block;
position: fixed;
color: white;
overflow: auto;
-moz-transition: -moz-transform 0.5s, visibility 0s 0.5s;
/* transition settings */
-webkit-transition: -webkit-transform 0.5s, visibility 0s 0.5s;
transition: transform 0.5s, visibility 0s 0.5s;
}
<label for="togglebox">
</label>
<input type="checkbox" id="togglebox" />
<nav id="offcanvas-menu">
<label for="togglebox" id="closex">×</label>
<label for="togglebox">
<div id="banner-inner">
<div id="banner-row-1">
<a4>Client</a4><br>
<a5>Client name</a5><br><br>
<a4>Year</a4><br>
<a5>2016</a5><br><br>
<a4>Collaboration</a4><br>
<a5>Name Person</a5>
</div>
<div id="banner-row-2">
<a4>Specifications</a4><br>
<a5>specifications</a5>
</div>
<div id="banner-row-3">
<p6>piece of text<p6><br><br>
<p6>piece of text</p6>
</div>
</div>
<div class="banner" id="banner">
<h4>Titel project</h4>
<h5>Identity, Typography, Web</h5>
<h6>↓ Info</h6>
</div>
</label>
</nav>
<br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br><br><br><br><br><br>Test<br><br><br><br><br>
You need to remove the translate3d from one of the parents (div#main-region), or else your position fixed will be based on that translate3d parent

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