Placeholder Loading Card not working correctly - html

I tried to create my bootstrap 4 web site to Placeholder Loading Card , i added sample image but i have some issue,
place holder not working in when the web site loading , is it always animate
anyone know how to do that correctly like this image
that is my code part
body {
padding: 20px;
}
.container {
display: flex;
border: 1px solid #eaecef;
height: 200px;
padding: 1%;
background-color: white;
box-shadow: 2px 5px 5px 1px lightgrey;
}
.img-container {
width: 15%;
padding: 20px;
}
.img {
border: 1px solid white;
width: 100%;
height: 100%;
background-color: #babbbc;
}
.content {
border: 1px solid white;
flex-grow: 1;
display: flex;
flex-direction: column;
padding: 20px;
justify-content: space-between;
}
.stripe {
border: 1px solid white;
height: 20%;
background-color: #babbbc;
}
.small-stripe {
width: 40%;
}
.medium-stripe {
width: 70%;
}
.long-stripe {
width: 100%;
}
.container.loading .img, .container.loading .stripe {
animation: hintloading 2s ease-in-out 0s infinite reverse;
-webkit-animation: hintloading 2s ease-in-out 0s infinite reverse;
}
#keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
#-webkit-keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<div class='container loading'>
<div class='img-container'>
<div class='img'>
<img src="https://image.freepik.com/free-photo/group-of-diverse-people-having-a-business-meeting_53876-25060.jpg">
</div>
</div>
<div class='content'>
<div class='stripe small-stripe'>wewe
</div>
<div class='stripe medium-stripe'>ewe
</div>
<div class='stripe long-stripe'>wewe
</div>
</div>
</div>

you need to disable the content placeHolder animation after page end load :
$(document).ready(function(){
$(".container.loading .img, .container.loading .stripe").css("animation", "none");
$(".container.loading .img, .container.loading .stripe").css("-webkit-animation", "none");
})
body {
padding: 20px;
}
.container {
display: flex;
border: 1px solid #eaecef;
height: 200px;
padding: 1%;
background-color: white;
box-shadow: 2px 5px 5px 1px lightgrey;
}
.img-container {
width: 15%;
padding: 20px;
}
.img {
border: 1px solid white;
width: 100%;
height: 100%;
background-color: #babbbc;
}
.content {
border: 1px solid white;
flex-grow: 1;
display: flex;
flex-direction: column;
padding: 20px;
justify-content: space-between;
}
.stripe {
border: 1px solid white;
height: 20%;
background-color: #babbbc;
}
.small-stripe {
width: 40%;
}
.medium-stripe {
width: 70%;
}
.long-stripe {
width: 100%;
}
.container.loading .img, .container.loading .stripe {
animation: hintloading 2s ease-in-out 0s infinite reverse;
-webkit-animation: hintloading 2s ease-in-out 0s infinite reverse;
}
#keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
#-webkit-keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<div class='container loading'>
<div class='img-container'>
<div class='img'>
<img src="https://image.freepik.com/free-photo/group-of-diverse-people-having-a-business-meeting_53876-25060.jpg">
</div>
</div>
<div class='content'>
<div class='stripe small-stripe'>wewe
</div>
<div class='stripe medium-stripe'>ewe
</div>
<div class='stripe long-stripe'>wewe
</div>
</div>
</div>
To see the effect of Content PlaceHolder i do this example where the data will be loaded after 3 seconds :
loadData = function(){
setTimeout(function(){
$(".content div").html("wewe");
$(".img img").attr('src', 'https://image.freepik.com/free-photo/group-of-diverse-people-having-a-business-meeting_53876-25060.jpg');
$(".container.loading .img, .container.loading .stripe").css("animation", "none");
$(".container.loading .img, .container.loading .stripe").css("-webkit-animation", "none");
}, 3000);
}
loadData();
body {
padding: 20px;
}
.container {
display: flex;
border: 1px solid #eaecef;
height: 200px;
padding: 1%;
background-color: white;
box-shadow: 2px 5px 5px 1px lightgrey;
}
.img-container {
width: 15%;
padding: 20px;
}
.img {
border: 1px solid white;
width: 100%;
height: 100%;
background-color: #babbbc;
}
.content {
border: 1px solid white;
flex-grow: 1;
display: flex;
flex-direction: column;
padding: 20px;
justify-content: space-between;
}
.stripe {
border: 1px solid white;
height: 20%;
background-color: #babbbc;
}
.small-stripe {
width: 40%;
}
.medium-stripe {
width: 70%;
}
.long-stripe {
width: 100%;
}
.container.loading .img, .container.loading .stripe {
animation: hintloading 2s ease-in-out 0s infinite reverse;
-webkit-animation: hintloading 2s ease-in-out 0s infinite reverse;
}
#keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
#-webkit-keyframes hintloading
{
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<div class='container loading'>
<div class='img-container'>
<div class='img'>
<img>
</div>
</div>
<div class='content'>
<div class='stripe small-stripe'>
</div>
<div class='stripe medium-stripe'>
</div>
<div class='stripe long-stripe'>
</div>
</div>
</div>

Related

How do I get the content centered when In absolute positioning?

So as said above, I have (for fun) recreated a website (hologram.io), because I'm new to CSS, and just wanted to see what I can do myself without help... But I can't figure out how I can position the whole first section which is absolute (-> On top of an Image) center, center. So vertical and horizontal, So that on bigger screens it always stays perfectly in the center of the menu... On the other sections which are not absolute, I used display: flex, justify-content: center and align-items center, which works perfectly... On the screenshots I have included, you can see the problem... Also, will include the code. It looks a bit messy, but should be fine haha...
Here you can see the noncentered Absolute item
Here you can see the flex items which are perfectly centered on every screensize and
And here for Refernce is the hologram website...
#font-face {
font-family: Robert Sans;
src: url(RobertSans-Regular.ttf);
}
#navtextonly li {
list-style-type: none;
display: inline;
padding: 15px;
text-align: center;
}
.listitem:hover {
cursor: pointer;
color: #4e6cff;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-right: 0px;
padding-right: 0px;
}
nav {
background-color: rgb(255, 255, 255);
}
body {
margin: 0px;
font-family: Robert Sans;
}
#navbarouter {
display: flex;
align-items: center;
justify-content: center;
}
#navtextonly {
white-space: nowrap;
}
#mainmenuwobtnlogo {
margin-right: 100px;
}
ul {
font-size: 16px;
}
#buttonsmenu1 {
background-color: white;
border: 1px solid #4e6cffce;
padding: 12px 23px 12px 23px;
border-radius: 25px;
margin-right: 15px;
-webkit-box-shadow: 2px 2px 15px 1px #999999;
box-shadow: 2px 2px 15px 1px #999999;
}
#buttonsmenu1:hover {
border-color: #111;
cursor: pointer;
}
#buttonsmenu2 {
background-color: #4e6cff;
padding: 12px 23px 12px 23px;
color: white;
border-radius: 25px;
-webkit-box-shadow: 2px 2px 15px 1px #999999;
box-shadow: 2px 2px 15px 1px #999999;
}
#buttonsmenu2:hover {
background-color: #788fff;
color: white;
cursor: pointer;
}
.buttonsmenuouter {
margin-left: 25px;
}
#hamburgernav {
display: none;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
.mainheading {
font-size: 64px;
white-space: nowrap;
font-weight: 400;
}
#h1top,
#h1bottom {
margin: 0px;
padding: 0px;
}
article {
color: rgb(255, 255, 255);
max-width: 550px;
}
#ellipse {
position: absolute;
top: 0px;
left: 630px;
}
#drohnepng {
position: absolute;
top: -50px;
left: 880px;
height: 80px;
}
#cartpng {
position: absolute;
top: 80px;
left: 585px;
height: 250px;
}
#rollerpng {
position: absolute;
top: 140px;
left: 825px;
height: 440px;
}
#content1 {
position: absolute;
top: 250px;
left: 12%;
}
#outerouter {
max-width: 1300px;
}
#glowh1 {
background: linear-gradient(
-60deg,
#904e95,
#904e95,
#e73c7e,
#ee7752,
#4e6cff,
white
);
background-size: 600%;
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
animation: animate 10s linear infinite;
}
#keyframes animate {
0% {
background-position: 0%;
}
100% {
background-position: 600%;
}
}
#paragraph {
width: 390px;
color: rgb(199, 199, 199);
font-size: 20px;
margin-bottom: 30px;
}
#emailwithsubmit {
display: flex;
}
.emailfeld {
width: 100%;
padding: 18px 23px 18px 23px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
}
#submitbtn {
padding: 18px 35px 18px 35px;
border-radius: 25px 25px 25px 25px;
color: white;
font-weight: 600;
border-width: 0px;
background-image: linear-gradient(90deg, #00a6ff, #7831ca, #fe17c0);
position: relative;
left: -60px;
}
#mainpart2,
#mainpart3 {
display: flex;
align-items: center;
justify-content: center;
margin: 100px 60px 100px 60px;
}
#mainpart2-3outer {
}
#card {
margin-left: 60px;
margin-right: 100px;
height: 280px;
/* -webkit-animation: fadein 3.2s both;
-moz-animation: fadein 3.2s both;
-o-animation: fadein 3.2s both;
animation: fadein 3.2s both; */
animation: float2 6s ease-in-out infinite;
}
#keyframes float2 {
0% {
transform: translatey(0px);
}
50% {
transform: translateX(-10px);
}
100% {
transform: translatey(0px);
}
}
#-webkit-keyframes fadein {
0% {
opacity: 0;
-webkit-transform: translateX(-25px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
#-moz-keyframes fadein {
0% {
opacity: 0;
-moz-transform: translateX(-50px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
#-0-keyframes fadein {
0% {
opacity: 0;
-o-transform: translateX(-50px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
#keyframes fadein {
0% {
opacity: 0;
transform: translateX(-50px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
#ellipse {
-webkit-animation: fade 5s both;
-moz-animation: fade 5s both;
-o-animation: fade 5s both;
animation: fade 5s both;
}
#-webkit-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-0-keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#cartpng,
#drohnepng,
#rollerpng {
/* -webkit-animation: fadein 3.2s both;
-moz-animation: fadein 3.2s both;
-o-animation: fadein 3.2s both;
animation: fadein 3.2s both;
transform: translatey(0px); */
animation: float 6s ease-in-out infinite;
}
#keyframes float {
0% {
transform: translatey(0px);
}
50% {
transform: translatey(-50px);
}
100% {
transform: translatey(0px);
}
}
#mainh-1,
#mainp-1 {
max-width: 280px;
}
#mainh-2,
#mainp-2 {
max-width: 280px;
}
.main1h,
.main1p,
.main2h,
.main2p {
display: flex;
flex-direction: row;
justify-content: space-between;
}
#mainh-3,
#mainp-3 {
max-width: 280px;
}
#mainh-4,
#mainp-4 {
max-width: 280px;
}
#mainh-1,
#mainh-2,
#mainh-3,
#mainh-4 {
margin: 0px;
padding: 0px;
}
#textmainpart2 {
margin-right: 60px;
}
.main2h1 {
margin-bottom: 40px;
}
.contentmainpart3-1 {
max-width: 475px;
margin-left: 60px;
}
.contentmainpart3-2 {
margin-right: 60px;
}
#beforefootercentered {
text-align: center;
margin-bottom: 75px;
}
.beforefootercolumncontent {
display: flex;
flex-direction: row;
justify-content: center;
gap: 100px;
margin-left: 100px;
margin-right: 100px;
margin-bottom: 50px;
}
.beforefootericons {
height: 66px;
width: 66px;
}
#beforefootercolumncontent1,
#beforefootercolumncontent2,
#beforefootercolumncontent3 {
max-width: 280px;
text-align: center;
}
#list2banner {
display: flex;
flex-direction: row;
margin-top: 20px;
}
#list1bannerouter {
max-width: 725px;
}
.footerbanner {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background-image: linear-gradient(90deg, #7831ca, #00a5ff);
margin: 0px 190px 0px 190px;
border-radius: 10px;
padding-left: 30px;
padding-top: 25px;
padding-right: 30px;
padding-bottom: 50px;
color: white;
position: relative;
top: 100px;
}
.footerbanner h2 {
font-size: 40px;
font-weight: 400;
margin-bottom: 10px;
}
#list1banner {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
#list1banner li:before {
content: "✓";
padding-right: 5px;
}
#btn1,
#btn2 {
border-radius: 25px;
padding: 10px 20px 10px 20px;
}
#btn1 {
margin-right: 20px;
background-color: #111;
border-width: 0px;
}
#btn2 {
background-image: transparent;
border: 1px solid white;
}
#pfeil {
margin-left: 5px;
}
#mainfooter {
height: 600px;
background-color: #0a1435;
}
#mainfooterupper {
height: 100px;
background-color: #0a1435;
display: none;
}
.item1 {
margin-right: 20px;
}
#placehold {
position: absolute;
top: 3100px;
left: 50%;
transform: translate(-50%, -50%);
color: rgb(255, 255, 255);
font-size: 70px;
}
#media only screen and (max-width: 1350px) {
html,
body {
overflow-x: hidden;
}
body {
position: relative;
}
#navtextonly {
font-size: 14px;
}
li {
padding-right: 20px;
}
#mainmenuwobtnlogo {
margin-left: 0px;
margin-right: 0px;
}
#navbarouter {
display: flex;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 0px;
width: 120px;
}
.buttonsmenuouter {
margin-left: 25px;
font-size: 14px;
margin-right: 0px;
}
#buttonsmenu1,
#buttonsmenu2 {
padding: 9px 17px 9px 17px;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
}
#media only screen and (max-width: 990px) {
html,
body {
overflow-x: hidden;
}
body {
position: relative;
}
#navtextonly {
display: none;
}
#navbarouter {
margin-left: 20px;
margin-right: 20px;
display: flex;
justify-content: space-between;
}
#hologramlogo {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
}
.buttonsmenuouter {
margin-left: 0px;
}
#hamburgernav {
margin-top: 20px;
margin-bottom: 20px;
margin-left: 20px;
margin-right: 20px;
display: inline;
}
#backgroundverlauf {
height: 800px;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
.mainheading {
font-size: 50px;
}
#paragraph {
font-size: 19px;
}
}
#media only screen and (max-width: 570px) {
.mainheading {
font-size: 30px;
}
#paragraph {
font-size: 16px;
}
#content1 {
position: absolute;
top: 175px;
}
article {
color: rgb(255, 255, 255);
max-width: 500px;
display: flex;
flex-direction: column;
margin-right: 20px;
}
#floatingimages {
display: none;
}
#paragraph {
width: 300px;
color: rgb(199, 199, 199);
font-size: 16px;
margin-bottom: 30px;
}
#backgroundverlauf {
height: 500px;
}
.emailfeld {
width: 80%;
padding-bottom: 20px;
padding: 13px 20px 13px 20px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
}
#submitbtn {
width: 87%;
position: absolute;
left: 10px;
top: 280px;
padding-bottom: 20px;
padding: 13px 20px 13px 20px;
border-radius: 25px 26px 26px 25px;
border-width: 0px;
border: 1px red solid;
/*
padding: 13px 30px 13px 30px;
border-radius: 25px 25px 25px 25px;
color: white;
font-weight: 600;
margin-left: 0px;
border-width: 0px;
background-image: linear-gradient(90deg, #00a6ff, #7831ca, #fe17c0);*/
}
#emailwithsubmit {
display: flex;
gap: 13px;
flex-direction: column;
align-items: center;
}
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="styles2.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index2</title>
</head>
<div>
<nav>
<div id="navbarouter">
<img
id="hologramlogo"
src="610f51dabc2bd752a968dfac_Hologram Logo Black Text.svg"
alt="Logo"
width="130px"
/>
<ul id="navtextonly">
<li class="listitem">Cellular IoT</li>
<li class="listitem">Why Hologram</li>
<li class="listitem">Resources</li>
<li class="listitem">Plans</li>
<li class="listitem">Jobs</li>
<li class="listitem">Store</li>
<span class="buttonsmenuouter">
<li id="buttonsmenu1">Contact Sales</li>
<li id="buttonsmenu2">Sign in</li>
</span>
</ul>
<div id="hamburgernavouter">
<img id="hamburgernav" src="hamburgernav.svg" alt="hamburgernav" />
</div>
</div>
</nav>
<div id="outerouterouter">
<img
src="background1.png"
id="backgroundverlauf"
alt="backgroundverlauf"
/>
<div id="outerouter">
<div id="content1">
<article>
<h1 class="mainheading" id="h1top">Internet everywhere.</h1>
<p class="mainheading" id="h1bottom">For every<span id="glowh1">thing</span>.</p>
<p id="paragraph">Spend less time monitoring your IoT deployments and more time innovating. Hologram's cellular platform enables you to connect and manage any device, anywhere in the world.</p>
<div id="emailwithsubmit">
<input type="email" class="emailfeld" autocomplete="email" maxlength="256" name="Email" data-name="Email" placeholder="E-Mail-Adresse" id="email" data-validation="email required email length" required="" data-validation-event="keyup change" data-validation-length="max256">
<input type="submit" value="Get started" data-wait="Please wait..." class="c-button is--gradient w-button disabled" disabled="disabled" id="submitbtn">
</div>
</article>
<div id="floatingimages">
<img class="sideimages" id="ellipse" src="backgroundellipse.png" alt="ellipse">
<img class="sideimages" id="drohnepng" src="drohne.png" alt="drohne">
<img class="sideimages" id="cartpng" src="cart.png" alt="cart">
<img class="sideimages" id="rollerpng" src="roller.png" alt="roller">
</div>
</div>
</div>
</div>
<div id="mainpart2-3outer">
<div id="mainpart2">
<div id="cardcontainer">
<img id ="card" src="card.png" alt="card">
</div>
<div id="textmainpart2">
<h1 class="main2h1"> Testüberschrift: global IoT connectivity platform</h1>
<div class="main1h">
<h2 id="mainh-1">One global SIM card</h2>
<h2 id="mainh-2">Automatic carrier switching</h2>
</div>
<div class="main1p">
<p id="mainp-1">Connect to 470+ networks in 200 countries using a single hardware-agnostic SIM card or eSIM eUICC chip. </p>
<p id="mainp-2">Hologram SIMs automatically switch between local carriers to ensure you have top performance and never lose service.</p>
</div>
<div class="main2h">
<h2 id="mainh-3">Flexible, scalable pricing</h2>
<h2 id="mainh-4">Connectivity tools for your team</h2>
</div>
<div class="main2p">
<p id="mainp-3">No contracts, quotas, or negotiations. Activate, change, or pause plans anytime via our Hologram Dashboard or APIs.</p>
<p id="mainp-4">Collaboratively manage your fleet with ease via our easy-to-use Dashboard or our modern REST API.</p>
</div>
</div>
</div>
<div id="mainpart3">
<div class="contentmainpart3-1">
<img src="hyper.svg" alt="hyper">
<h1>Testüberschrift2: flexibility and coverage with Hyper</h1>
<p>Future-proof your SIMs and scale faster globally with Hyper, Hologram’s eUICC SIMs and platform. Hyper provides over-the-air, updatable access to Hologram’s full portfolio of IoT connectivity partners and profiles.</p>
<p>What is Hyper? --></p>
</div>
<div class="contentmainpart3-2">
<img src="image maincontent3.png" alt="ballwiththingsmainpart3right" height= "570px">
</div>
</div>
</div>
<div id="beforefootercentered">
<h1>Scaling connectivity has never been so easy</h1>
<p>The simplest way to get your IoT deployment connected worldwide.</p>
</div>
<div class="beforefootercolumncontent">
<div id="beforefootercolumncontent1">
<img src="antenne.svg" loading="lazy" alt="cell tower icon" class="beforefootericons">
<h3 class="">No hassles or headaches</h3>
<p class="">Focus on your product and data — not connectivity infrastructure, negotiations, and pricing.</p>
</div>
<div id="beforefootercolumncontent2">
<img src="speedometer.svg" loading="lazy" alt="dashboard icon" class="beforefootericons">
<h3 class="">Ready to grow your business</h3>
<p class="">Manage global deployments from a single connectivity platform with pricing that scales as you do.</p>
</div>
<div id="beforefootercolumncontent3">
<img src="settings.svg" loading="lazy" alt="gear icon" class="beforefootericons">
<h3 class="">All the tools you need</h3>
<p class="">Our Hologram Dashboard, REST API, and supported hardware make integrating connectivity easy.</p>
</div>
</div>
<footer>
<div id="mainfooterupper"></div>
<div class="footerbanner">
<div id="list1bannerouter">
<h2>Try Hologram today.</h2>
<ul id="list1banner">
<li class="item1">Free Sim</li>
<li class="item1">1 MB/mo free</li>
<li>Connect and scale in days</li>
</ul>
</div>
<div id="list2banner">
<div id="btn1">Sign up free<img id="pfeil" src="pfeil.svg"></div>
<div id="btn2">Contact sales <img id="pfeil" src="pfeil.svg"></div>
</div>
</div>
<div id="mainfooter">
<h1 id="placehold">Footer Items Soon</h1>
</div>
</footer>
</main>
</body>
</html>
Use this to your container[absolute] element
.container{
position: absolute;
/* For Vertically center */
top: 50%;
transform: translateY(-50%);
/* For Horizontally center */
left: 50%;
transform: translateX(-50%);
}
If You're using height and width without positioning use this
.container{
--height: 100px;
height: var(--height);
/* Horizontally Center */
margin: auto;
/* Vertically Center */
margin-top: calc(50% - var(--height));
}

Stop animation from right to left

I want this progress bar to animate only from left to right, starting from text. After animation ends from right to left, it starts animating from right to left, from some point. Note, I need to use the flexbox and width for text.
.table-bars .bar-box .text {
height: 100%;
margin: 0 30px 0 200px;
width: 200px;
text-align:right;
}
.bar-box {
margin-bottom:20px;
}
.table-bars div .progress {
background-color: #0071b9;
border-radius: 20px;
border-right: 13px solid rgb(0, 173, 239);
-webkit-animation: progressBar 2s ease-in-out;
-webkit-animation-fill-mode:both;
-moz-animation: progressBar 2s ease-in-out;
-moz-animation-fill-mode:both;
height: 20px;
}
#-webkit-keyframes progressBar {
0% { width: 0; }
100% { width: 100%; }
}
#-moz-keyframes progressBar {
0% { width: 0; }
100% { width: 100%; }
}
.bar-box {
display: flex;
}
<div class="table-bars">
<div class="bar-box">
<div class="text"><span>TEXT</span></div>
<div class="progress"></div>
</div>
<div class="bar-box">
<div class="text"><span>Another TEXT</span></div>
<div class="progress"></div>
</div>
</div>
You need to either add flex-shrink:0 to avoid the shriking of the text because you are setting width:100%
.table-bars .bar-box .text {
height: 100%;
margin: 0 30px 0 200px;
width: 200px;
text-align: right;
flex-shrink:0;
}
.bar-box {
margin-bottom: 20px;
}
.table-bars div .progress {
background-color: #0071b9;
border-radius: 20px;
border-right: 13px solid rgb(0, 173, 239);
animation: progressBar 2s ease-in-out;
animation-fill-mode: both;
height: 20px;
}
#keyframes progressBar {
0% {
width: 0;
}
100% {
width: 100%;
}
}
.bar-box {
display: flex;
}
<div class="table-bars">
<div class="bar-box">
<div class="text"><span>TEXT</span></div>
<div class="progress"></div>
</div>
<div class="bar-box">
<div class="text"><span>Another TEXT</span></div>
<div class="progress"></div>
</div>
</div>
Or animate the flex-grow instead of width:
.table-bars .bar-box .text {
height: 100%;
margin: 0 30px 0 200px;
width: 200px;
text-align: right;
flex-shrink:0;
}
.bar-box {
margin-bottom: 20px;
}
.table-bars div .progress {
background-color: #0071b9;
border-radius: 20px;
border-right: 13px solid rgb(0, 173, 239);
animation: progressBar 2s ease-in-out;
animation-fill-mode: both;
height: 20px;
}
#keyframes progressBar {
0% {
flex-grow: 0;
}
100% {
flex-grow: 1;
}
}
.bar-box {
display: flex;
}
<div class="table-bars">
<div class="bar-box">
<div class="text"><span>TEXT</span></div>
<div class="progress"></div>
</div>
<div class="bar-box">
<div class="text"><span>Another TEXT</span></div>
<div class="progress"></div>
</div>
</div>
Related: Why is a flex item limited to parent size?

Cordova Application mdc-app-bar not going all the way across the top. Styling is messed up.

I have a cordova application on a Zebra(Android) device that is doing something weird with the screen sizing, it is not being styled the same way it looks in chrome. We are using Angular 6 Here is what it is supposed to look like and does look like in chrome:
Then here is what it is looking like on the Zebra device:
is there a way to fix this? we are using a mdc-app-bar from this library:
https://trimox.github.io/angular-mdc-web/#/home
here is my code for the navigation-bar-component.html
<mdc-app-bar [primary]="true" [fixed]="false">
<mdc-app-bar-row class="mat-elevation-z2">
<mdc-app-bar-section align="start">
<mdc-icon (click)="sidenav.open()" mdcAppBarNavIcon>menu</mdc-icon>
<mdc-app-bar-title>{{title}}</mdc-app-bar-title>
</mdc-app-bar-section>
</mdc-app-bar-row>
</mdc-app-bar>
Here is my navigation-bar-component.scss
span {
padding-left: 10px;
}
.mdc-top-app-bar {
position: relative;
z-index: 4;
}
mdc-app-bar-title {
color: rgba(0, 0, 0, 0.87);
}
mdc-app-bar {
background-color: #ffcc00;
}
mdc-app-bar-section {
background-color: #ffcc00;
}
mdc-app-bar-row {
background-color: #ffcc00;
}
mdc-icon {
color: rgba(0, 0, 0, 0.87) !important;
}
Then here is my code in my app.component.html
<mdc-drawer #sidenav drawer='temporary' [closeOnClick]="false">
<mdc-drawer-header>
<mdc-drawer-header-content>
<span flex></span>
<div layout="row">
<div class="logo-click-target"></div>
</div>
<span flex></span>
<div class="row" (click)="toggleState()" [ngClass]="flip ? 'clicked' : 'flipReverse'">
<div class="user-information">
<div class="md-body-2">Firstname Lastname</div>
<div class="md-body-1">email#domainname.com</div>
</div>
<div class="dropArrowButton">
<mdc-icon [ngClass]="flip ? 'flip' : 'flipReverse'">arrow_drop_down</mdc-icon>
</div>
</div>
</mdc-drawer-header-content>
</mdc-drawer-header>
<mdc-drawer-content>
<div [ngClass]="!flip ? 'navListEnter' : 'navListExit'">
<mdc-list-group>
<h3 mdcListGroupSubheader>Mobile Terminal</h3>
<mdc-list>
<mdc-list-item (click)="goToPage('track-selection')" routerLinkActive="active">
<mdc-list-item-text>Track Update</mdc-list-item-text>
</mdc-list-item>
</mdc-list>
</mdc-list-group>
</div>
<div [ngClass]="flip ? 'userListEnter' : 'userListExit'" class="listElements">
<mdc-list-group>
<h3 mdcListGroupSubheader>User Settings</h3>
<mdc-list>
<mdc-list-item>
<mdc-list-item-text>Settings</mdc-list-item-text>
</mdc-list-item>
<mdc-list-item>
<mdc-list-item-text>Logout</mdc-list-item-text>
</mdc-list-item>
</mdc-list>
</mdc-list-group>
</div>
</mdc-drawer-content>
</mdc-drawer>
<app-navigation-bar [sidenav]="sidenav"></app-navigation-bar>
<router-outlet></router-outlet>
And here is my app.component.scss file
$device-width: 360px;
.example-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100vh;
}
[flex] {
box-sizing: border-box;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.side-nav {
width: 256px;
}
.md-body-1 {
font-size: 14px;
font-weight: 400;
letter-spacing: 0.01em;
line-height: 20px;
}
mdc-drawer-header-content {
background-color: white !important;
border-bottom: 1px #ddd solid;
color: rgba(0, 0, 0, 0.87);
}
mdc-icon {
color: rgba(0, 0, 0, 0.87) !important;
}
.md-body-2,
md-list .md-subheader,
md-list-item.md-2-line .md-list-item-text h4,
md-list-item.md-2-line .md-list-item-text p,
md-list-item.md-2-line > .md-no-style .md-list-item-text h4,
md-list-item.md-2-line > .md-no-style .md-list-item-text p,
md-list-item.md-3-line .md-list-item-text h4,
md-list-item.md-3-line .md-list-item-text p,
md-list-item.md-3-line > .md-no-style .md-list-item-text h4,
md-list-item.md-3-line > .md-no-style .md-list-item-text p {
font-size: 14px;
font-weight: 500;
letter-spacing: 0.01em;
line-height: 24px;
}
mat-toolbar {
box-sizing: border-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
z-index: 2;
font-size: 20px;
min-height: 64px;
width: 100%;
}
.mat-nav-list a.active {
background: blue;
}
mat-sidenav > mat-toolbar {
padding: 15px;
height: 150px;
max-height: 150px;
}
:host .logo-click-target {
width: var(--application-header-logo-width, 50px);
height: var(--application-header-logo-width, 50px);
background-position-x: 5px;
background-position-y: 5px;
background-repeat: no-repeat;
background-image: url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.or…0%200%202.308-6.42c-.002-2.655-.823-4.803-1.674-6.87z%22%2F%3E%3C%2Fsvg%3E);
background-image: var(
--up-header-logo,
url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2236%22%20height%3D%2240%22%20viewBox%3D%220%200%2036%2040%22%3E%3Cpath%20fill%3D%22%2300309B%22%20d%3D%22M26.607.132a18.726%2018.726%200%200%201-18.177%200L8.193%200%20.96%207.717l.242.238a7.36%207.36%200%200%201%202.205%205.275c0%201.95-.74%203.74-1.522%205.633C.958%2021.105%200%2023.423%200%2026.405c0%203.197%201.406%206.23%203.86%208.316%202.923%202.486%205.972%202.69%208.42%202.85%202.217.146%203.967.26%204.938%201.918l.3.513.3-.512c.972-1.656%202.722-1.77%204.938-1.918%202.45-.16%205.498-.364%208.423-2.85a10.915%2010.915%200%200%200%203.856-8.315c0-2.982-.958-5.3-1.885-7.542-.782-1.893-1.52-3.682-1.52-5.633a7.36%207.36%200%200%201%202.205-5.275l.24-.238L26.847%200l-.24.132z%22%2F%3E%3Cg%20fill%3D%22%23FFF%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.093%2018.154v14.673l-.008-.004A10.298%2010.298%200%200%200%205.717%2035.1V18.152H3.093z%22%2F%3E%3Cpath%20d%3D%22M8.345%2018.154V36.24c.894.243%201.768.368%202.618.447V18.154H8.345zm5.243%200v18.73l.188.02c.568.06%201.103.147%201.594.288.296.084.58.19.85.324V18.154h-2.632zm5.228%200v19.362c.27-.133.554-.24.85-.324a9.23%209.23%200%200%201%201.593-.288l.187-.02v-18.73h-2.632zm5.258%200v18.533c.85-.08%201.724-.204%202.616-.447V18.154h-2.616z%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M31.942%2018.154H29.32v16.944a10.8%2010.8%200%200%200%201.35-.973c.466-.396.895-.83%201.282-1.303l-.01.004V18.154z%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M3.016%2018.154c-.183.457-.372.915-.563%201.383C1.603%2021.602.78%2023.75.78%2026.405c0%202.44.873%204.677%202.313%206.426V18.156h-.077zm2.7%200v16.942c.886.54%201.757.9%202.63%201.14v-18.08h-2.63zm5.247%200V36.7c.362.035.73.048%201.08.07.537.037%201.054.068%201.545.115v-18.73h-2.625zm5.257%200V37.52a3.85%203.85%200%200%201%201.298%201.032c.374-.46.812-.79%201.3-1.032V18.154H16.22zm5.228%200v18.73c.49-.046%201.008-.077%201.543-.114.354-.022.72-.035%201.085-.07V18.155H21.45zm5.242%200v18.083c.873-.24%201.743-.6%202.63-1.14V18.153h-2.63zm5.33%200h-.077V32.83a10.075%2010.075%200%200%200%202.313-6.425c0-2.654-.82-4.803-1.672-6.868-.19-.468-.38-.926-.563-1.383z%22%20fill%3D%22%23CE0000%22%2F%3E%3Cg%20fill%3D%22%23FFF%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M14.84%2013.15c-.016-.628.446-1.058%201.022-1.072.29-.007.663.143%201.05.244v-1.15c-.186-.117-.69-.26-1.007-.26-1.177%200-2.217.89-2.217%202.225s1.04%202.23%202.217%202.23c.317%200%20.82-.145%201.007-.26v-1.152c-.387.1-.76.25-1.05.244-.575-.016-1.037-.446-1.02-1.073v.02z%22%2F%3E%3Cpath%20d%3D%22M17.793%205.44h-1.23v4.18h1.23V5.44m-6.106%204.18h1.182V7.514h.01L14.3%209.62h1.343V5.44H14.37v2.21h-.01l-1.426-2.21h-1.248v4.18M9.55%205.438h1.21v2.327c0%20.532-.022%201.06-.44%201.46-.352.34-.904.46-1.396.46-.49%200-1.043-.12-1.395-.46-.42-.4-.443-.928-.443-1.46V5.438h1.21v2.028c0%20.538-.077%201.125.626%201.125s.625-.585.625-1.123v-2.03z%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M19.638%207.538c0-.572.47-1.036%201.046-1.036s1.046.464%201.046%201.036-.47%201.035-1.046%201.035-1.046-.463-1.046-1.035zm-1.173%200c0-1.213.993-2.197%202.22-2.197s2.218.985%202.218%202.2c0%201.212-.993%202.195-2.22%202.195s-2.218-.983-2.218-2.196z%22%2F%3E%3Cpath%20d%3D%22M23.617%209.62H24.8V7.514h.012L26.23%209.62h1.34V5.44H26.3v2.21h-.012l-1.423-2.21h-1.248v4.18M24.91%2011h-1.228v4.178h1.23v-4.18m-2.072.937V11h-2.842v4.178h1.24v-1.455h1.6v-.98h-1.6v-.808h1.6M19.07%2011h-1.23v4.178h1.23v-4.18%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M26.882%2013.15c-.017-.628.444-1.058%201.02-1.072.29-.007.664.143%201.05.244v-1.15c-.185-.117-.688-.26-1.007-.26-1.176%200-2.217.89-2.217%202.225s1.04%202.23%202.217%202.23c.318%200%20.822-.145%201.008-.26v-1.152c-.387.1-.762.25-1.05.244-.576-.016-1.037-.446-1.02-1.073v.02zm-15.115.36l-.43-1.34-.447%201.34h.877zm-1.217.95l-.254.718H9.134l1.508-4.18h1.384l1.508%204.18H12.37l-.253-.72H10.55zm-3.46-2.53h.734a.44.44%200%200%201%20.438.44c0%20.24-.196.502-.44.502h-.73v-.942zm.815-.93c.78%200%201.406.63%201.406%201.41s-.63%201.413-1.41%201.413h-.81v1.356H5.944V11h1.963z%22%2F%3E%3C%2Fg%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M32.584%2019.537c-.19-.468-.38-.926-.563-1.383H3.018c-.183.457-.372.915-.563%201.383C1.604%2021.602.78%2023.75.78%2026.405c0%202.438.87%204.672%202.31%206.42l-.004-.002c.387.472.815.906%201.28%201.303.443.377.905.695%201.352.97.885.542%201.756.902%202.628%201.142.894.245%201.768.37%202.618.45.362.034.73.06%201.08.083.537.04%201.054.07%201.545.117l.186.02c.568.06%201.103.146%201.594.287.297.084.58.193.85.327.487.243.927.574%201.3%201.033.373-.46.81-.79%201.298-1.03.27-.134.554-.24.85-.325a8.952%208.952%200%200%201%201.593-.288l.19-.023c.49-.047%201.01-.078%201.544-.115.352-.022.72-.05%201.083-.083.85-.08%201.724-.207%202.616-.45.873-.24%201.743-.6%202.63-1.14a10.8%2010.8%200%200%200%201.35-.974c.466-.396.895-.83%201.282-1.303l-.005.002a10.078%2010.078%200%200%200%202.308-6.42c-.002-2.655-.823-4.803-1.674-6.87z%22%2F%3E%3C%2Fsvg%3E')
);
}
.mat-toolbar-row,
.mat-toolbar-single-row {
align-items: end;
white-space: nowrap;
}
.row {
display: flex;
flex-direction: row;
width: 100%;
padding: 3px 8px;
border-radius: 5px;
.user-information {
flex-grow: 1;
color: rgba(0, 0, 0, 0.87);
}
.dropArrowButton {
flex-shrink: 1;
color: #fff;
align-self: center;
position: relative;
top: 4px;
}
}
.mat-list .mat-list-item,
.mat-nav-list .mat-list-item,
.mat-selection-list .mat-list-item {
font-size: 14px;
font-weight: 500;
border-radius: 5px;
margin: 0 10px;
}
.mat-list-item:focus,
.mat-menu-item:focus {
outline: none;
}
.flip {
animation: flip 200ms ease-in forwards;
}
.flipReverse {
animation: reverse 200ms ease-in-out forwards;
}
.userListEnter {
animation: 'userListEnter' 100ms ease-in forwards;
}
.userListExit {
animation: 'userListExit' 100ms ease-in-out forwards;
display: none;
}
.navListEnter {
animation: 'navListEnter' 100ms ease-in forwards;
}
.navListExit {
animation: 'navListExit' 100ms ease-in-out forwards;
display: none;
}
.clicked {
background-color: rgba(0, 51, 153, 0.08);
}
// WILL NEED REPLACING - PLACEHOLDER
// END
.mdc-drawer--temporary .mdc-drawer__header-content {
display: flex;
position: absolute;
top: 0;
right: 0;
flex-direction: column;
bottom: 0;
left: 0;
align-items: normal;
box-sizing: border-box;
padding: 16px;
}
#keyframes flip {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-180deg);
}
}
#keyframes reverse {
from {
transform: rotate(-180deg);
}
to {
transform: rotate(0deg);
}
}
#keyframes navListEnter {
0% {
transform: translateY(100px);
opacity: 0;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
#keyframes navListExit {
0% {
opacity: 1;
}
100% {
opacity: 0;
display: none;
}
}
#keyframes userListEnter {
0% {
transform: translateY(-50px);
opacity: 0;
}
100% {
transform: translateY(0px);
opacity: 1;
}
}
#keyframes userListExit {
0% {
opacity: 1;
}
100% {
display: none;
opacity: 0;
}
}
#media only screen and (max-width: $device-width) {
.side-nav {
width: calc(#{$device-width} - 56px);
}
}
in my index.html including this line fixed it:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
should just have to override <body> default margins.
body {
margin: 0;
}

CSS Animation Sequence

I've been coding a very simple "Traffic Light" program and have run into a problem where it doesn't run after the first #keyframes section completes correctly. From my own research online I'm guessing that I would need a transition(?) so that when the first #keyframes is complete, the next one would be run. However my inexperience with this I'm not sure if its whats required here. Essentially is there a "trigger" I'm missing or is it just something obvious I've left out?
Please excuse the rough code. Its does work as I described above
body {
background-color: #4d4d00
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
#red {
position: absolute;
left: 50px;
text-align: center;
padding: 30px;
background-color: #e60000;
margin: 10px auto;
width: 50px;
height: 50px;
border-radius: 200px;
animation: red 4s 1s 3 linear;
}
#amber {
position: absolute;
left: 1px;
text-align: center;
padding: 30px;
background-color: #ff3300;
margin: 10px auto;
width: 50px;
height: 50px;
border-radius: 200px;
animation: amber 4s 1s 3 linear;
}
#green {
position: absolute;
left: 1px;
text-align: center;
padding: 30px;
background-color: #009933;
margin: 10px auto;
width: 50px;
height: 50px;
border-radius: 200px;
animation: green 4s 1s 3 linear;
}
#keyframes red {
from {
background-color: #e60000;
}
to {
background-color: #000000;
}
#keyframes amber {
from {
background-color: #ff3300;
}
to {
background-color: #000000;
}
#keyframes green {
from {
background-color: #009933;
}
to {
background-color: #000000;
}
}
<div class="container">
<div class="row">
<div id="red">
<br>
<br>
<div id="amber">
<br>
<br>
</div>
</div>
</div>
</div>
you may use animation-delay.
here is a short/minimal code example.
.red {
background: red;
}
.orange {
background: orange
}
.green {
background: lime;
}
/* layout */
div {
display: flex;
height: 150px;
width: 50px;
flex-direction: column;
border-radius: 1em;
background: #555;
margin: 1em;
}
b {
flex: 1;
margin: 5px;
border-radius: 50%;
animation: fade 9s steps(2, end) infinite;
box-shadow: 0 0 5px white
}
/* animation */
#keyframes fade {
66%,
100% {
background: gray;
box-shadow: 0 0
}
}
.red {
animation-delay: -12s
}
.orange {
animation-delay: -6s;
}
<div class=trafficLights>
<b class=red></b>
<b class=orange></b>
<b class=green></b>
</div>
here is a codepen to play with : https://codepen.io/gc-nomade/pen/YVWeQq
You have two way to do this
1) is use animation-delay and set an higher delay to elements you would like to animate after.
animation-delay: 1s;
-webkit-animation-delay:1s;
2) trigger an element.addClass("animatedClass"); with the end of a css animation using animationonend jquery function.
$(".animatedElement").one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(event) {
$(".animatedElement").addClass("newAnimatedClass");
});

Setting z-index on fixed position element makes it drop behind all other content

I would like my .control-panels element to be fixed positioned. The problem is that when I do so .tracks overlaps it. I've tried adjusting the z-index of both .tracks and .control-panels but it doesn't work. How can I have my .control-panels stay ontop of other content.
HTML
<section ng-controller="ProjectController" id="project">
<div class="work-station">
<div class="control-panels">
<div ng-repeat="track in project.tracks track by $index" class="control-panel">{{track.name}}</div>
</div>
<div class="tracks">
<div ng-repeat="track in project.tracks track by $index" class="track">
<div ng-repeat="i in getNumber(project_cells) track by $index" class="cell"></div>
</div>
</div>
</div>
<md-button class="md-fab md-primary add-track">
<md-icon>circle</md-icon>
</md-button>
</section>
CSS
#project {
height: 100%;
.work-station {
height: 100%;
display: flex;
height: calc(100% - 20px);
padding: 20px;
padding-top: 0;
overflow-x: auto;
.control-panels {
display: flex;
flex-direction: column;
flex-basis: 15%;
min-width: 150px;
.control-panel {
min-height: $min-ws-row-height;
flex-grow: 1;
border: 1px solid $sublime-black;
border-top: none;
&:first-child {
border-top: 1px solid $sublime-black;
}
}
}
.tracks {
height: 100%;
display: flex;
flex-direction: column;
.track {
min-height: $min-ws-row-height;
flex-grow: 1;
list-style-type: none;
display: flex;
flex-basis: 15%;
}
.track:first-child {
border: 1px solid $codepen-grey;
}
.track:not(first-child) {
border: 1px solid $codepen-grey;
border-top: none;
}
.cell {
min-width: 80px;
background: $sublime-black;
outline: 2px solid $codepen-grey;
}
}
}
.add-track {
position: fixed;
bottom: 30px;
right: 30px;
}
}
#keyframes slideInLeft {
from {
transform: translate3d(-100%, 0, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
.slide-in-left {
animation-name: slideInLeft;
animation-duration: 250ms;
visibility: visible !important;
}