I have an input with a pseudo element that I'm trying to animate on hover.. I wanted the white line on the input to infinitely scroll to the right out of view and come back in on the left etc.. Is this possible?
.buttonWrap {
position: relative;
}
.buttonWrap:before {
content: '';
width: 20px;
border-bottom: solid 2px #fff;
position: absolute;
top: 50%;
right: .5rem;
transform: translateY(-50%);
}
.buttonWrap:hover::before {
animation: J 1s ease 0s infinite normal none;
}
.uiBtn.redBtn {
background: #1a1a1a;
text-transform: uppercase;
text-align: left;
color: #fff;
min-width: 16.25rem;
font-size: .6875rem;
cursor: pointer;
letter-spacing: 1px;
line-height: 1rem;
width: auto;
margin-top: 2rem;
font-weight: 600;
padding:10px;
}
<span class="buttonWrap">
<input type="submit" class="uiBtn redBtn" value="Submit">
</span>
An example using transform property (I've slow down the duration just to check the fluidity)
.buttonWrap {
position: relative;
}
.buttonWrap:before {
content: '';
width: 20px;
border-bottom: solid 2px #fff;
position: absolute;
top: calc(50% - 1px);
right: .5rem;
}
.buttonWrap:hover::before {
animation: J 5s linear 0s infinite;
}
.uiBtn.redBtn {
background: #1a1a1a;
text-transform: uppercase;
text-align: left;
color: #fff;
min-width: 16.25rem;
font-size: .6875rem;
cursor: pointer;
letter-spacing: 1px;
line-height: 1rem;
width: auto;
margin-top: 2rem;
font-weight: 600;
padding:10px;
}
#keyframes J {
0% { transform: translateX(0); right: .5rem; }
10% { transform: translateX(calc(100% + .5rem)); right: .5rem; }
10.01% { transform: translateX(-100%); right: 100%; }
93% { transform: translateX(-100%); right: .5rem; }
}
<span class="buttonWrap">
<input type="submit" class="uiBtn redBtn" value="Submit">
</span>
FYI; here's what ended up working for me! .. animation happens when you hover over the button..
.underline::after {
content: "";
height: 2px;
display: inline-block;
position: absolute;
left: 0;
width: 30px;
top:50%;
background: #fff;
transition: all;
}
.underline {
position: absolute;
right: .5rem;
top: 50%;
width: 30px;
}
.underlined-animated:hover .underline::after {
animation: underline-animated 1s infinite;
width: auto;
animation-delay: -.5s;
}
.underlined-animated {
position: relative;
}
#keyframes underline-animated {
0% {
right: 100%;
}
50% {
right: 0;
left: 0;
}
100% {
right: 0;
left: 100%;
}
}
.uiBtn.redBtn {
background: #1a1a1a;
text-transform: uppercase;
text-align: left;
color: #fff;
min-width: 16.25rem;
font-size: .6875rem;
cursor: pointer;
letter-spacing: 1px;
line-height: 1rem;
width: auto;
margin-top: 2rem;
font-weight: 600;
padding:10px;
}
<span class="underlined-animated">
<span class="underline"></span>
<input type="submit" class="uiBtn redBtn" value="Submit">
</span>
Related
I want to set the h2 text on the animation. But i cant able to do that -_-.
here is the live link http://leander.web.dnodes.net/
source code: https://github.com/LeleEdits/website-new
change css to
.h2-parent {
position: absolute;
top: 0;
left: 0;
height: 100%;
max-width: 600px;
width: 600px;
padding-left: 10px;
padding-right: 10px;
z-index: 10;
}
h2
{
position: relative;
width: 100%;
top: 40%;
transform: translateY(-50%);
font-size: 5vw;
color: rgba(255,255,255,0.5);
text-transform: uppercase;
}
.abs-h2
{
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: #5865f2;
-webkit-text-stroke: 0vw rgb(51, 51, 51);
border-right: 2px solid #5865f2;
overflow: hidden;
animation: animate-t 6s linear infinite;
}
.abs-h2 h2
{
position: relative;
width: 600px;
top: 40%;
left:10px;
transform: translateY(-50%);
font-size: 5vw;
color: #5865f2;
text-transform: uppercase;
}
and change html to
<div class="h2-parent">
<h2 data-text="Improve your Server...">Improve your Server...</h2>
<div class="abs-h2">
<h2 data-text="Improve your Server...">Improve your Server...</h2>
</div>
</div>
demo in js<>fiddle
My animation is not ending at the end of text what do I do to make it stop after displaying some text.
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
}
#keyframes animate {
0%,
100% {
width: 0;
}
70%,
90% {
width: 100%;
}
}
<h2 data-text="Hi..">Hi..</h2>
I'm a beginner so don't know a lot of things
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
}
#keyframes animate {
0%,
100% {
width: 0;
}
70%,
90% {
width: 100%;
}
}
<h2 data-text="Hi Atih <3">Hi Atih <3</h2>
I just played with width and it works
width: 0; was causing the issue
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2 {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
animation-fill-mode: forwards;
}
#keyframes animate {
0% {
width: 100px;
height: 100px;
}
100% {
width: 100%;
height: 100%;
}
}
<h2 data-text="Hi..">Hi..</h2>
I'm trying to position the input form in the middle of form container using margin: 0 auto;, but not working.
I selected the div container and apply this:
.group {
position: relative;
top: 20px;
margin: 0 auto;
}
body {
background-color: Royalblue; /*#f0f0f0;*/
margin: 0px;
}
form {
position: relative;
top: 90px;
margin: 0 auto;
width: 280px;
height: 340px;
border: 1px solid #B0C4DE;
background: royalblue;
border-radius: 0px;
border-radius: 10px 10px 10px 10px;
}
/* Main EFFECT ================================ */
input {
position: relative;
top: 0px;
left: 0px;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 1px solid white;
background: transparent;
font-size: 15px;
height: 25px;
width: 180px;
outline: 0;
z-index: 1;
color: black;
}
label {
display: block;
}
span {
position: absolute;
top: 7px;
left: 0px;
font-family: 'Montserrat', sans-serif;
font-size: 13px;
z-index: 1;
color: white;
transition: top .5s ease, font-size .5s ease;
}
.group {
position: relative;
top: 20px;
margin: 0 auto;
}
/*
label::after {
content: '';
position: absolute;
top: 5px;
left: 0px;
width: 200px;
height: 23px;
border-radius: 2px;
background: beige;
transition: transform .7s;
transform: scale3d(1, 0.1, 1);
transform-origin: bottom;
}
*/
/*
input:focus + label::after {
top: 5px;
transform: scale3d(1, 1.2, 1);
transition-timing-function: linear;
}
input:focus + label > span {
top: -20px;
font-size: 10px;
}
*/
<body>
<form>
<div class="group">
<input class="input1" type="email" id="email" required />
<label class="label1" for="email">
<span class="sp1">Email</span>
</label>
</div>
</form>
</body>
without width browser can not calculate how much margins it will put to left/right
you can see here in your case decrease width
http://prntscr.com/kvqscq
body {
background-color: Royalblue; /*#f0f0f0;*/
margin: 0px;
}
form {
position: relative;
top: 90px;
margin: 0 auto;
width: 280px;
height: 340px;
border: 1px solid #B0C4DE;
background: royalblue;
border-radius: 0px;
border-radius: 10px 10px 10px 10px;
}
/* Main EFFECT ================================ */
input {
position: relative;
top: 0px;
left: 0px;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 1px solid white;
background: transparent;
font-size: 15px;
height: 25px;
width: 180px;
outline: 0;
z-index: 1;
color: black;
}
label {
display: block;
}
span {
position: absolute;
top: 7px;
left: 0px;
font-family: 'Montserrat', sans-serif;
font-size: 13px;
z-index: 1;
color: white;
transition: top .5s ease, font-size .5s ease;
}
.group {
position: relative;
top: 20px;
margin: 0 auto;
width: max-content;
}
/*
label::after {
content: '';
position: absolute;
top: 5px;
left: 0px;
width: 200px;
height: 23px;
border-radius: 2px;
background: beige;
transition: transform .7s;
transform: scale3d(1, 0.1, 1);
transform-origin: bottom;
}
*/
/*
input:focus + label::after {
top: 5px;
transform: scale3d(1, 1.2, 1);
transition-timing-function: linear;
}
input:focus + label > span {
top: -20px;
font-size: 10px;
}
*/
<body>
<form>
<div class="group">
<input class="input1" type="email" id="email" required />
<label class="label1" for="email">
<span class="sp1">Email</span>
</label>
</div>
</form>
</body>
Give your .group class below css, and you're all set...
.group {
width: max-content;
}
Now label will also move into center...
try this
.sp1{
left : 70px;
}
Im having a very annoying problem in Shopify. My banners were working fine but all of a sudden this class called "row" came up and is pushing my banner off to the side on both mobile and desktop. I cant get my banners to work correctly, I went through my entire code to see if I had any errors and I do not, I tried to look for a ".row" that could be messing up everything but its only gridlock .row and that is something I dont feel I should be messing with, as im not sure what it does. Anyhow, thank you for your time!
Any help is greatly appreciated!
Problem
What I see as the issue
CSS
.bannerheadercontainer {
width: 100vw;
position: relative;
top: 0px;
left: calc(-50vw + 50%);
display: table;
padding: 0px;
margin: 0px;
}
.bannercontainer {
position: relative;
width: 100%;
}
.bannercontainer .btnstyle {
font-weight: bold;
position: absolute;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-appearance: none;
color: white;
font-size: 15px;
font-size: 4vw;
border: none;
border-radius: 0px! important;
height: 16%;
text-align: center;
line-height: 0vw;
cursor: pointer;
}
.bannercontainer .imgstyle {
position: absolute;
}
.bannercontainer .btnstyle span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.bannercontainer .btnstyle span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.bannercontainer .btnstyle:hover span {
padding-right: 25px;
}
.bannercontainer .btnstyle:hover span:after {
opacity: 1;
right: 0;
}
.bannercontainer .btnstyleDesktop {
position: absolute;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-appearance: none;
color: white;
font-weight: bold;
font-size: 8px;
font-size: 1.5vw;
border: none;
border-radius: 0px! important;
height: 12%;
text-align: center;
line-height: 0vw;
cursor: pointer;
}
.bannercontainer .btnstyleDesktop span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.bannercontainer .btnstyleDesktop span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.bannercontainer .btnstyleDesktop:hover span {
padding-right: 25px;
}
.bannercontainer .btnstyleDesktop:hover span:after {
opacity: 1;
right: 0;
}
.bannerimg {
filter: brightness(30%);
}
/*------ CSS MOBILE ONLY -----*/
#media only screen and (max-width: 599px) {
.bannerheadercontainer {
top: -10px;
}
.pagetitle {
font-size: 18px !important;
}
.overlaybanner {
top: -1px;
height: 98%;
}
.index-banner {
height: 300px !important;
background-size: 200% 100%;
background-repeat: no-repeat;
}
.styc-container {
width: 100%;
}
.index-gray-section-style {
background-color: #F9F9F9;
min-height: 390px;
width: 100%;
}
.index-gray-section-connected {
background-color: #F9F9F9;
min-height: 390px;
width: 100%;
}
}
HTML CODE
<!----START BANNER----->
<div id="content-desktop">
<div class="bannerheadercontainer">
<img style="width: 100%;" class="bannerimg" src="https://cdn.shopify.com/s/files/1/0025/8719/7497/files/ecobanner-compressor_2048x2048.png?v=1529095445">
<div class="overlayheaderbanner"></div>
<div class="pagetitle">ECO-FRIENDLY</div>
</div>
</div>
<div id="content-mobile">
<div class="bannerheadercontainer">
<img style="width: 100%;" class="bannerimg" src="https://cdn.shopify.com/s/files/1/0025/8719/7497/files/eco-compressor_large.png?v=1529427950">
<div style="top: 0px; height: 97%;" class="overlayheaderbanner"></div>
<div class="pagetitle">ECO-FRIENDLY</div>
</div>
</div>
<!----END BANNER----->
Change width '100vw to 100%' in your code, it will work
.bannerheadercontainer { width: 100%;}
I'm using a loader in my application, but I can't manage to properly centre it.
As you are going to see it's slightly moved to left side of the screen.
Here's the fiddle: Loader
Here's the HTML code:
<div class="loader">
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
</div>
Here's the SCSS code:
.loader-graph-default{
background-color: black;
display: none;
}
.loader-graph-loading{
display: inline;
position: absolute;
z-index: 100;
height: 100%;
width: 100%;
}
.loader {
background: none;
position: relative;
width: 60px;
height: 60px;
margin: auto;
text-align: center;
&__hexagon {
position: absolute;
width: 12px;
height: 20px;
margin: 5px;
transform: rotate(30deg);
animation: fade 1s infinite;
animation-delay: 0s;
background: white;
&--value {
background: #009ECB;
}
&:first-of-type {
top: 20px;
left: -12px;
animation-delay: .4s;
}
&:last-of-type {
top: 20px;
left: 12px;
animation-delay: .2s;
}
&:before {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height:20px;
background: inherit;
transform: rotate(-62deg);
}
&:after {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height: 20px;
background: inherit;
transform: rotate(62deg);
}
}
}
#keyframes fade{
0%{
opacity: 1;
}
50%{
opacity: .1;
}
100%{
opacity: 1;
}
}
If you go to the fiddle and you inspect the div with the class "loader" you can see that it's not centred.
What am I missing?
when you rotate a div, of course it changes it centre point, so i just repositioned it.
.loader-graph-default{
background-color: black;
display: none;
}
.loader-graph-loading{
display: inline;
position: absolute;
z-index: 100;
height: 100%;
width: 100%;
}
.loader {
background: none;
position: relative;
width: 60px;
height: 60px;
margin: auto;
text-align: center;
&__hexagon {
position: absolute;
width: 12px;
height: 20px;
margin: 5px;
transform: rotate(30deg);
animation: fade 1s infinite;
animation-delay: 0s;
/*background: $uiColor;*/
background: white;
/*
&--carbon {
background: $carbon;
}
&--value {
background: $value;
}
&--research {
background: $research;
}
&--quality {
background: $quality;
}
*/
&--value {
background: #009ECB;
}
&:first-of-type {
top: 20px;
right: 50%;
margin-left: 3px;
animation-delay: 0.4s;
}
&:last-of-type {
top: 20px;
left: 50%;
animation-delay: 0.2s;
margin-left: 6px;
}
&:nth-child(2) {
left: 50%;
margin-left: -6px;
}
&:before {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height:20px;
background: inherit;
transform: rotate(-62deg);
}
&:after {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height: 20px;
background: inherit;
transform: rotate(62deg);
}
}
}
#keyframes fade{
0%{
opacity: 1;
}
50%{
opacity: .1;
}
100%{
opacity: 1;
}
}
<div class="loader">
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
</div>
Fiddle
You can set loader width 60px to 48px to resolve this. check updated snippet below..
.loader-graph-default {
background-color: black;
display: none;
}
.loader-graph-loading {
display: inline;
position: absolute;
z-index: 100;
height: 100%;
width: 100%;
}
.loader {
background: none;
position: relative;
width: 48px;
height: 60px;
margin: auto;
text-align: center;
left: 12px;
}
.loader__hexagon {
position: absolute;
width: 12px;
height: 20px;
margin: 5px;
transform: rotate(30deg);
animation: fade 1s infinite;
animation-delay: 0s;
background: white;
}
.loader__hexagon--value {
background: #009ECB;
}
.loader__hexagon:first-of-type {
top: 20px;
left: -12px;
animation-delay: 0.4s;
}
.loader__hexagon:last-of-type {
top: 20px;
left: 12px;
animation-delay: 0.2s;
}
.loader__hexagon:before {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height: 20px;
background: inherit;
transform: rotate(-62deg);
}
.loader__hexagon:after {
content: " ";
position: absolute;
left: 0;
top: 0;
width: 12px;
height: 20px;
background: inherit;
transform: rotate(62deg);
}
#keyframes fade {
0% {
opacity: 1;
}
50% {
opacity: 0.1;
}
100% {
opacity: 1;
}
}
<div class="loader">
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
<div class="loader__hexagon loader__hexagon--value"></div>
</div>
You have added left:-12px to the first of div with class "loader__hexagon loader__hexagon--value", which shifts the whole block to the left by -12px.
Also the width of the Loader is not 60px.
The style should be as given below :
.loader__hexagon:first-of-type {
top: 20px;
animation-delay: 0.4s;}
Add a style for second child:
.loader__hexagon:nth-child(2) {
left: 12px; }
Edit style of third child:
.loader__hexagon:last-of-type {
top: 20px;
left: 23px;
animation-delay: 0.2s; }
Reduce the width of the loader to 45px:
.loader {
background: none;
position: relative;
width: 45px;
height: 60px;
margin: auto;
text-align: center; }
You are using absolute positioning on your hexagons, that's why they are not centered, try a different approach such as display: inline-block with adjusted margins (some space inbetween) for bottom hexagons.
&__hexagon {
margin: 0 auto;
}
&:first-of-type {
display: block;
}
&:nth-child(2) {
margin-right: 4px;
display: inline-block;
}
&:last-of-type {
margin-left: 4px;
display: inline-block;
}
fiddle