position:fixed moves on mobile scroll - css

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

Related

Why does my CSS Transition depend on zoom and resolution?

I've been struggling for a while with an animation that always seems to be inaccurate despite many attempts to fix it.
I would like a "minus" symbol to turn into a "plus" on the hover event. The rotation of the minus happens but the two lines (vertical and horizontal) never seem to be centered and at the end of the animation the vertical line adds some pixels seeming slightly wider than when it was horizontal. Changing resolution or zooming changes the geometry of the vertical line. The vertical line is not centered or becomes more "fat".
What I am looking for is a perfect animation that is independent of resolution and various imperfections.
On Codepen I reported the relevant code, try to play with it a little.
HTML:
<div>
<a class="n-button button-flat n-button-default-size button-default button-1 n-button-default-span n-button-default-type" target="_self" href="#" style="margin-left:124px;">
<i class="fa-minus fas button-icon-left" aria-hidden="true"></i><span class="n-button-text">Guarda cosa facciamo</span>
</a>
</div>
CSS:
* {
box-sizing: border-box;
}
body {
background-color: black;
--button-border-radius-top-left: 0px;
--button-border-radius-top-right: 0px;
--button-border-radius-bottom-right: 0px;
--button-border-radius-bottom-left: 0px;
margin: 0;
color: #747474;
min-width: 320px;
-webkit-text-size-adjust: 100%;
font: 13px/20px PTSansRegular,Arial,Helvetica,sans-serif;
}
.n-button.button-1{
border-radius:0px 0px 0px 0px;
}
.n-button{
outline: 0;
display: inline-block;
position: relative;
text-align: center;
text-decoration: none;
cursor: pointer;
box-sizing: border-box;
font-family: var(--button_typography-font-family);
font-weight: var(--button_typography-font-weight);
font-style: var(--button_typography-font-style,normal);
letter-spacing: var(--button_typography-letter-spacing);
border-width: var(--button_border_width-top,0) var(--button_border_width-right,0) var(--button_border_width-bottom,0) var(--button_border_width-left,0);
border-style: solid;
border-radius: var(--button-border-radius-top-left,0) var(--button-border-radius-top-right,0) var(--button-border-radius-bottom-right,0) var(--button-border-radius-bottom-left,0);
text-transform: var(--button_text_transform);
transition: all .2s;
}
.n-button.button-flat {
box-shadow: none!important;
}
.n-button-default-size, button.button {
padding-top: var(--button_padding-top,13px);
padding-right: var(--button_padding-right,29px);
padding-bottom: var(--button_padding-bottom,13px);
padding-left: var(--button_padding-left,29px);
line-height: var(--button_line_height, 1);
font-size: var(--button_font_size, 14px);
}
.button-default{
background: var(--button_gradient_top_color);
color: var(--button_accent_color);
border-color: var(--button_border_color);
}
a{
transition-property: color,background-color,border-color;
transition-duration: .2s;
transition-timing-function: linear;
}
div{
margin: 20px;
}
/*************/
.fa-minus:before {
top: 0;
position: absolute;
}
.fa-minus.fas.button-icon-left{
margin-right: 30px;
}
.fa-minus.fas.button-icon-left, .icon-minus.button-icon-left {
color: #f3ad00 !important;
}
a:hover .fa-minus.fas.button-icon-left:before{
content: "\f068";
top: 0;
position: absolute;
margin-right: 30px;
}
.n-button i, .n-button-text {
transition: all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
}
.fa-minus.fas.button-icon-left:after {
content: "\f068";
display: block;
position: absolute;
transition : all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
top: 0
}
a:hover .fa-minus.fas.button-icon-left:after {
content: "\f068";
transform: rotate(90deg);
transition: all 1s cubic-bezier(0.66, 0.01, 0, 1.07) 0s;
}
:root {
--button_padding-top: 0px;
--button_padding-bottom: 10px;
--button_padding-left: 0px;
--button_padding-right: 0px;
--button_typography-font-family: Montserrat, Arial, Helvetica, sans-serif;
--button_typography-font-weight: 400;
--button_typography-letter-spacing: 0px;
--button_font_size: 18px;
--button_line_height: 20px;
--button_text_transform: none;
--button_gradient_top_color: rgba(255,255,255,0);
--button_gradient_top_color_hover: rgba(255,255,255,0);
--button_accent_color: rgba(255,255,255,0.69);
--button_border_width-top: 0px;
--button_border_width-right: 0px;
--button_border_width-bottom: 0px;
--button_border_width-left: 0px;
--button_border_color: rgba(255,255,255,0);
--button_padding: 11px 23px;
}
Many thanks in advance

Fetch Cards not returning in a grid - returning one on top of each other

I've got a small problem but I cannot seem to find a solution. I have a page which is fetching data from a JSON, but instead of the cards returning in a dynamic grid, the cards are returning one on top of each other. Does anyone know a fix (I feel like I've overlooked something very very simple...)
#import url('https://fonts.googleapis.com/css2?family=Aclonica&family=Audiowide&family=Black+Ops+One&family=Bungee&family=Bungee+Hairline&family=Bungee+Inline&family=Bungee+Outline&family=Bungee+Shade&family=Days+One&family=Michroma&family=Monoton&family=Racing+Sans+One&family=Titillium+Web:ital,wght#0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap');
#font-face {
font-family: D2DTitle1;
src: url(fonts/Formula1-Regular_web_0.ttf);
}
#font-face {
font-family: D2DTitle2;
src: url(fonts/Formula1-Bold_web_0.ttf);
}
#font-face {
font-family: D2DTitle3;
src: url(fonts/Formula1-Wide_web_0.ttf);
}
#font-face {
font-family: D2DBody1;
src: url(fonts/TitilliumWeb-ExtraLight.ttf);
}
#font-face {
font-family: D2DBody2;
src: url(fonts/TitilliumWeb-Light.ttf);
}
#font-face {
font-family: D2DBody3;
src: url(fonts/TitilliumWeb-Regular.ttf);
}
#font-face {
font-family: D2DBody4;
src: url(fonts/TitilliumWeb-SemiBold.ttf);
}
#font-face {
font-family: D2DBody5;
src: url(fonts/TitilliumWeb-SuperBold.ttf);
}
#font-face {
font-family: D2DBody6;
src: url(fonts/TitilliumWeb-SuperSuperBlack.ttf);
}
#font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?oymsdl');
src: url('fonts/icomoon.eot?oymsdl#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?oymsdl') format('truetype'),
url('fonts/icomoon.woff?oymsdl') format('woff'),
url('fonts/icomoon.svg?oymsdl#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-news:before {
content: "\e900";
}
.icon-flag:before {
content: "\e901";
}
.icon-helmet:before {
content: "\e902";
}
.icon-wheel:before {
content: "\e903";
}
.icon-specials:before {
content: "\e91c";
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000000;
color: #ffffff;
box-sizing: border-box;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: 'D2DBody2';
min-height: 100vh;
text-align: center;
overflow-x: hidden;
}
body > * {
width: 100%;
}
h1,
h2,
h3,
h7 {
text-transform: uppercase;
text-align: center;
}
h1 {
font-size: 35pt;
color: black;
-webkit-text-stroke-width: 1.3px;
-webkit-text-stroke-color: white;
font-family: 'D2DTitle2', sans-serif;
margin: 1.5rem 0;
}
h2 {
font-size: 18pt;
color: white;
font-family: 'D2DTitle2', sans-serif;
}
h3 {
font-size: 14pt;
color: white;
text-align: center;
font-family: 'D2DTitle2', sans-serif;}
h4 {
font-size: 11pt;
color: white;
text-align: left;
font-family: 'D2DBody1';
}
h5 {
font-size: 8pt;
font-style: italic;
margin-right: 10px;
color: white;
text-align: right;
font-family: 'D2DBody1';
}
h6 {
font-size: 10pt;
color: white;
text-align: center;
font-family: 'D2DBody1';
}
h7 {
font-size: 12pt;
color: white;
text-align: center;
font-family: 'D2DTitle2', sans-serif;}
p {
font-size: 12pt;
margin-bottom: 12pt;
}
.container {
max-width: 90%;
margin: 0 auto;
}
.iframe {
width: 100%;
max-width: 1000px;
margin: 1rem 0;
}
.circuit-map > img {
display: block;
width: 100%;
height: 100%;
}
.circuit-map .circuit-controls {
position: absolute;
overflow: hidden;
display: flex;
transition: 0.3s;
cursor: pointer;
}
.circuit-map .circuit-controls img {
/* Display triggered via JavaScript, once circuit image loads */
display: none;
width: calc(100%);
min-width: calc(100%);
}
.circuit-map .circuit-controls#statsLeft,
.circuit-map .circuit-controls#statsRight {
top: 0;
width: 4%;
height: 90%;
margin: 3% 0;
}
.circuit-map .circuit-controls#statsLeft {
left: 0;
flex-direction: row-reverse;
}
.circuit-map .circuit-controls#statsRight {
right: 0;
}
.circuit-map .circuit-controls#statsLeft:hover,
.circuit-map .circuit-controls#statsRight:hover {
width: 95%;
}
.circuit-map .circuit-controls#statsTop,
.circuit-map .circuit-controls#statsBottom {
left: 0;
height: 6%;
width: 90%;
margin: 0 5%;
}
.circuit-map .circuit-controls#statsTop {
top: 0;
flex-direction: column-reverse;
}
.circuit-map .circuit-controls#statsBottom {
bottom: 0;
flex-direction:column;
}
.circuit-map .circuit-controls#statsTop:hover,
.circuit-map .circuit-controls#statsBottom:hover {
height: 91%;
}
.sector {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 2rem 0;
max-width: 1200px;
}
.sector .sector-card {
position: relative;
width: 100%;
max-width: 322px;
min-height: 322px;
background: #000;
cursor: pointer;
overflow: hidden;
margin: 0.5rem;
}
.sector-card .content {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
padding: 5px;
padding-bottom: 40px;
}
.sector-card .face {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: 0.5s;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.sector-card:hover .face {
transform: translateY(calc(100% - 35px));
}
.sector-card .face h2 {
font-size: 1.75em;
text-shadow: 0.1em 0.1em black;
}
.sector-card .content p {
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-align: center;
margin-bottom: 0;
}
.sector-card:nth-of-type(1) .content p {
background-color: rgb(255, 0, 0);
}
.sector-card:nth-of-type(2) .content p {
background-color: rgb(0, 179, 228);
}
.sector-card:nth-of-type(3) .content p {
background-color: rgb(254, 213, 42);
}
#about {
top: 1em;
background-color: black;
font-weight: 500;
font-family: 'D2DTitle2';
}
#media screen and (max-width: 915px) {
h1 {
font-size: 25pt;
}
h2 {
font-size: 14pt;
}
p {
font-size: 11pt;
}
}
.countries-container {
margin-top: 2rem;
margin-bottom: 2rem;
width: 100%;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.countries-container .card {
position: relative;
width: 250px;
margin: 0 1rem 1rem 0;
background-color: #4D4D4D;
cursor: pointer;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.countries-container .card .card-header .card-title {
color: white;
display: absolute;
margin: 0;
text-align: center;
line-height: 1.2;
padding: 0.5rem 0.75rem;
white-space: pre-wrap;
}
.countries-container .card .card-header img {
display: absolute;
height: 167px;
-o-object-fit: cover;
object-fit: cover;
}
.countries-container .card .card-body {
padding: 0.5rem 0.75rem;
}
.countries-container .card .card-body .card-body-item {
margin-bottom: 0.5rem;
}
.countries-container .card .card-body .card-body-item:last-child {
margin-bottom: 0;
}
.countries-container .card .card-body .card-body-item p {
margin: 0;
}
.card-img-caption .card-img-top {
z-index: 0;
}
.linkicons{
width: 30px;
}
.race-container {
position: relative;
text-align: center;
color: white;
height: 150px;
width: 90%;
overflow: hidden;
background-size: cover;
background-position: center;
}
.r-result {
position: absolute;
color: white;
top: 40%;
right: 5%;
font-family: 'D2DTitle2', sans-serif;
font-size: 1.5em;
text-shadow: .1em .1em #4D4D4D;
text-transform: uppercase;
-webkit-text-stroke-width: 1.3px;
-webkit-text-stroke-color: black;
}
.points {
position: absolute;
color: white;
top: 70%;
right: 5%;
font-family: 'D2DTitle2', sans-serif;
font-size: 1.5em;
text-shadow: .1em .1em #4D4D4D;
text-transform: uppercase;
-webkit-text-stroke-width: 1.3px;
-webkit-text-stroke-color: black;
}
.q-result {
position: absolute;
color: white;
top: 10%;
right: 5%;
font-family: 'D2DTitle2', sans-serif;
font-size: 1.5em;
text-shadow: .1em .1em #4D4D4D;
text-transform: uppercase;
-webkit-text-stroke-width: 1.3px;
-webkit-text-stroke-color: black;
}
.round-name {
position: absolute;
color: white;
top: 40%;
left: 5%;
font-family: 'D2DTitle2', sans-serif;
font-size: 1.5em;
text-shadow: .1em .1em #4D4D4D;
text-transform: uppercase;
-webkit-text-stroke-width: 1.3px;
-webkit-text-stroke-color: black;
}
.specials {
position: relative;
text-align: center;
color: white;
width: 90%;
overflow: hidden;
background-size: cover;
background-position: center;
font-family: 'D2DTitle2', sans-serif;
font-size: 30px;
text-transform: uppercase;
}
.grid-container {
display: grid;
grid-template-columns: 25% 25%;
grid-gap: 50%;
font-size: 3em;
}
.countries-container .profile {
position: relative;
width: 275px;
margin: 1em 1em 1em 1em;
background-color: #000000;
cursor: pointer;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.countries-container .circuit {
position: relative;
width: 275px;
margin: .75em .75em .75em .75em;
background-color: #000000;
cursor: pointer;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.material-card {
position: relative;
padding-bottom: calc(100% - 16px);
margin-bottom: 1em;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border: 2px solid #fff;
}
.material-card h2 {
position: absolute;
top: calc(100% - 54px);
left: 0;
width: 100%;
height: 54px;
padding: 10px 16px;
color: #fff;
margin: 0;
z-index: 10;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.material-card h2 span {
display: block;
font-size: 0.63em;
}
.material-card h2 strong {
display: block;
font-size: 0.58em;
}
.material-card .mc-description {
position: absolute;
right: .5em;
left: .5em;
bottom: .5em;
overflow: hidden;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transition: all 1.2s;
-moz-transition: all 1.2s;
-ms-transition: all 1.2s;
-o-transition: all 1.2s;
transition: all 1.2s;
text-align: left;
}
.material-card .mc-footer {
height: 0;
overflow: hidden;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.material-card .img-container {
overflow: hidden;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 3;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.material-card.mc-active .mc-description {
top: 30px;
padding-top: 2em;
padding-bottom: 10px;
overflow-y: scroll;
opacity: 1;
filter: alpha(opacity=100);
color: white;
}
.material-card.Profile h2 {
background-color: #000000;
}
.material-card.Profile.mc-active .mc-content {
background-color: #4d4d4d;
}
.material-card.circuit h2 {
background-color: #000000;
}
.material-card.circuit.mc-active .mc-content {
background-color: #4d4d4d;
}
.material-card.mc-active h2 {
top: 0;
padding: 5px 0px 0px 2.5em;
}
.material-card .mc-content {
position: absolute;
right: 0;
top: 0;
bottom: 0px;
left: 0;
text-align: center;
overflow: hidden;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.material-card .mc-btn-action {
position: absolute;
right: 2px;
top: 2px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 44px;
height: 44px;
text-align: center;
color: #fff;
cursor: pointer;
z-index: 20;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.material-card.mc-active .mc-btn-action {
top: calc(100% - 34px);
}
.material-card.mc-active .img-container {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
width: 54px;
height: 54px;
z-index: 30;
left: 0px;
top: 0px;
}
.material-card.mc-active .mc-description-bottom {
position:flex;
bottom:0em;
right:0;
text-align: left;
}
.no-hover:hover {
background-color: transparent;
}
#myInput {
background-color: #000;
width: 60%;
font-size: 16px;
font-family: "D2DTitle2";
color: #fff;
padding: 12px 20px 12px 20px;
border: 1.5px solid #fff;
margin-bottom: 5px;
}
.standings-column {
float: left;
width: 50%;
padding: 15px;
}
.standings-row:after {
content: "";
display: table;
clear: both;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 190%;
}
#-webkit-keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
#keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
}
.ticker-wrap {
position: inline-block;
top: 0;
width: 100%;
overflow: hidden;
height: 4rem;
background-color: rgba(0, 0, 0, 0.9);
padding-left: 100%;
}
.ticker {
display: inline-block;
height: 4rem;
line-height: 4rem;
white-space: nowrap;
padding-right: 100%;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-name: ticker;
animation-name: ticker;
-webkit-animation-duration: 30s;
animation-duration: 30s;
}
.ticker_item {
display: inline-block;
padding: 0 2rem;
font-size: 2rem;
color: white;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
</head>
<body>
<header>
<a href="/index.html">
<img src="/vault/page-assets/Header.svg"></a>
<div id="nav-placeholder"></div>
<script>
$(function(){
$("#nav-placeholder").load("/vault/page-assets/nav.html");
});
</script>
<hr style="height:1px;background-color:white">
<h1>DIV</h1>
</header>
<script>
function myFunction() {
var input, filter, ul, li, a, i, txtValue;
input = document.getElementById('myInput');
filter = input.value.toUpperCase();
ul = document.getElementById("myUL");
li = ul.getElementsByTagName('li');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";}}}
</script>
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search On Page..">
<ul id="myUL">
<div id="countries" class="countries-container container">
<div id="myData"></div>
</div>
</ul>
<script>
jQuery(document).ready(($) => {
//Create variable to store the JSON
var data = `[
{
"id": 3,
"title": "2022",
"subtitle": "Season",
"answers":[
{ "name": "Driver Profiling", "value": "0" },
{ "name": "Driver Assessment", "value": "1" },
{ "name": "Driver Training", "value": "2" },
{ "name": "Driver Management", "value": "3" },
{ "name": "Driver License check", "value": "4" }
]
},
{
"id": 4,
"title": "2021",
"subtitle": "2021",
"answers":[
{ "name": "1 to 9 Drivers", "value": 0 },
{ "name": "10 to 49 Drivers", "value": 1 },
{ "name": "50 to 249 Drivers", "value": 2 },
{ "name": "250 to 1000 Drivers", "value": 3 },
{ "name": "More than 1000 Drivers", "value": 4 }
]
}
]`;
//Convert the data into JS arrays & objects
let readyData = JSON.parse(data);
// Just for testing
console.log(readyData);
//Use a loop function or for loop with append function inside it
let answers = '';
readyData.map((obj) => {
console.log(obj);
let answers = '';
obj.answers.map((answer) => {
answers = answers +`<p>${answer.name}</p>`;
});
$("#myData").append(`
<li class="li-no-hover"><div class="profile">
<article class="material-card Profile">
<a style="text-decoration: none;" href="/vault/season-archive/1950/index.html">
<h2><span>${obj.title}</span>
<strong>${obj.subtitle}</strong></h2>
<div class="mc-content">
<div class="img-container">
<img src="/vault/season-archive/1950/tile.png" alt="1950 Season" style="width: 100%";></div>
<div class="mc-description" style="text-align: left; line-height: 135%;">
${answers}
</div></div></a>
<a class="mc-btn-action">
<img style="width:60%" src="/page-assets/d2d-icon(left).svg"></a>
</article>
</div></li>
`);
});
});
</script>
<footer>
<div id="footer-placeholder"></div>
<script>
$(function(){
$("#footer-placeholder").load("../../page-assets/footer.html");
});
</script>
<footer>
<script>
$(function() {
$('.material-card > .mc-btn-action').click(function () {
var card = $(this).parent('.material-card');
var icon = $(this).children('i');
icon.addClass('fa-spin-fast');
if (card.hasClass('mc-active')) {
card.removeClass('mc-active');
window.setTimeout(function() {
icon
.removeClass('fa-arrow-left')
.removeClass('fa-spin-fast')
.addClass('fa-bars');
}, 800);
} else {
card.addClass('mc-active');
window.setTimeout(function() {
icon
.removeClass('fa-bars')
.removeClass('fa-spin-fast')
.addClass('fa-arrow-left');
}, 800);
}
});
});
</script>
</body>
</html>

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.

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

LI active data filter not applying on initial page load

I've managed to splice together this site for my wedding. I'm banging my head against the wall because I just don't know enough to get this done:
I can set the active attribute on the small gallery section of the site, but the data filter is not filtering the contents to the set active filter on initial page load only.
Example: I can set the active li to any section, and it will highlight it, but it displays all the photos and does not filter by the defined data filters.
Below is the CSS let me know if you need anything else.
/* ===========================================================
13. Small Gallery
============================================================ */
#wedding-gallery {
padding-bottom: 0;
}
#wedding-gallery h3.section-title:before {
margin-left: -17px;
font-size: 38px;
content: "\e00c";
}
#gallery-filter {
text-align: center;
line-height: 90px;
margin-bottom: 0;
}
#gallery-filter li {
display: inline-block;
line-height: 14px;
margin: 0 5px;
}
#gallery-filter li:last-child {
border-right: 0;
}
#gallery-filter li a {
font-size: 14px;
color: #666666;
padding: 8px 15px;
letter-spacing: 1px;
}
#gallery-filter li a:hover,
#gallery-filter li.active a {
background-color: #fff;
padding: 8px 15px;
border-radius: 6px;
}
#gallery-wrapper > div {
width: 25%;
overflow: hidden;
position: relative;
}
#gallery-wrapper > div img {
width: 100%;
display: block;
margin: 0;
}
#gallery-wrapper > .block.gallery img {
position: absolute;
z-index: 1;
top: 0;
}
#gallery-wrapper > .block img {
backface-visibility: hidden;
-webkit-transition: all 700ms;
-moz-transition: all 700ms;
transition: all 700ms;
transform: scale(1.1) rotate(0.1deg);
-ms-transform: scale(1.1) rotate(0.1deg);
-webkit-transform: scale(1.1) rotate(0.1deg);
-o-transform: scale(1.1) rotate(0.1deg);
-moz-transform: scale(1.1) rotate(0.1deg);
}
#gallery-wrapper .block .portfolio-hover,
#gallery-wrapper .block .video-hover {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 0;
text-align: center;
background: rgba(255, 140, 137, 0.7);
-webkit-transition: opacity 400ms ease 0s;
-moz-transition: opacity 400ms ease 0s;
transition: opacity 400ms ease 0s;
cursor: pointer;
z-index: 5;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}
#gallery-wrapper .block .portfolio-info {
position: absolute;
display: table;
width: 100%;
height: 100%;
}
#gallery-wrapper .block:hover .portfolio-hover,
#gallery-wrapper .block:hover .video-hover {
opacity: 1;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=95)";
filter: alpha(opacity=95);
}
#gallery-wrapper .portfolio-title {
display: table-cell;
height: 100%;
vertical-align: middle;
color: #fff;
text-transform: uppercase;
font-size: 16px;
padding: 0 35px;
}
#gallery-wrapper .portfolio-title span {
display: block;
color: #fff;
font-size: 12px;
}
.load-more {
margin-top: 55px;
text-align: center;
}
.load-more a {
color: #D9C6B1;
}
/* Portfolio isotope Animation
======================== */
.isotope,
.isotope .isotope-item {
-webkit-transition-duration: 0.4s;
-moz-transition-duration: 0.4s;
-ms-transition-duration: 0.4s;
-o-transition-duration: 0.4s;
transition-duration: 0.4s;
}
.isotope {
-webkit-transition-property: height, width;
-moz-transition-property: height, width;
-ms-transition-property: height, width;
-o-transition-property: height, width;
transition-property: height, width;
}
.isotope .isotope-item {
-webkit-transition-property: -webkit-transform, opacity;
-moz-transition-property: -moz-transform, opacity;
-ms-transition-property: -ms-transform, opacity;
-o-transition-property: -o-transform, opacity;
transition-property: transform, opacity;
}
/* ===========================================================
14. Twitter
============================================================ */
#twitter h3.section-title:before {
content: "\e00d";
font-size: 40px;
}
#twitter .vibe {
margin-bottom: 0;
}
#twitter .tweet {
font-size: 14px;
margin-top: 25px;
}
#twitter .time {
display: block;
font-size: 12px;
text-transform: uppercase;
}
#twitter .follow {
display: block;
margin-top: 55px;
font-weight: 700;
text-transform: uppercase;
color: #D9C6B1;
}
#twitter .follow:hover {
color: #FF8C89;
}
/* ===========================================================
15. Gift Registry
============================================================ */
#gift-registry h3.section-title:before {
content: "\e009";
}
.small-box {
text-align: center;
margin-top: 25px;
margin-bottom: 0;
}
.small-box li {
position: relative;
display: inline-block;
width: 160px;
height: 150px;
margin: 10px;
padding: 7px;
background: #fff;
}
.small-box li a.product {
display: inline-block;
width: 100%;
height: 100%;
line-height: 130px;
border: 1px solid #efe7df;
text-align: center;
}
.small-box li a img {
vertical-align: middle;
}
/* 5.1. Gift Money
============================================================ */
.small-box .money {
border: 1px solid #efe7df;
height: 100%;
border-radius: 25px;
}
.small-box .amount {
display: inline-block;
margin-top: 20px;
font: 28px/32px'Playfair Display', serif;
font-style: italic;
font-weight: 700;
color: #FF8C89;
}
.small-box .donate {
position: absolute;
bottom: 35px;
left: 27px;
z-index: 999;
color: #D9C6B1;
}
.small-box .donate:hover {
color: #FF8C89;
}
.small-box .donate:active {
top: 76px;
}
The answer is in your custom.js, actually -- here's the part relevant to that gallery:
$('#gallery-filter a').click(function() {
$('#gallery-filter li.active').removeClass('active');
$(this).parent().addClass('active');
var selector = $(this).attr('data-filter');
$container.isotope({
filter: selector,
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
return false;
});
Basically, that's the declaration of how those filter buttons on the gallery work. When clicked, they call $container.isotope, which is what actually handles the filtering and hiding of inactive elements. So if you want to set that on page load, you can invoke the same method but pass it a different filter. Does that make sense, or should I get into it in more detail?
EDIT: Adding more info here.
Since this whole js file is being called on document ready, this is pretty simple - you should be able to immediately "fake" a click on the button you want. Try putting this line in custom.js, immediately after the code above:
$('#gallery-filter a[data-filter=".FriendsandFamily"]').trigger('click');
What that should do is simulate a click on the Friends and Family button, making it active. You can do the same for the other tabs by changing the "data-filter" part of that line to match what's on them in the html. (If that doesn't work, let me know.)

Resources