CSS Responsive table - problem with height - html
few weeks ago I saw a simple, interesting list on codepen but unfortunately it was not resposnive.
I try to make that list responsive on my site for friend.
http://damianobajtek.pl/LandingAdamv2/ (Menu -> services).
I cannot resolve problem with height with media queries. I know that my div is too small (100vh) but what should I do to make it responsive?
Probably the simplest solution could be flexbox but I have a problem to remake that list on flexbox.
Thanks in advance for any advice :)
Changes here:
.second_services .content {
/* float: left; */
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex: 1 1 100%;
margin: 0;
padding: 0;
}
.second_services .content li {
/* float: left; */
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
/* width: 33.2%; */
flex: 1 1 calc(100% / 3);
box-sizing: border-box;
height: 25%;
position: relative;
display: flex;
flex-wrap: wrap;
/* Colors Hover */
}
#media (max-width: 1024px) {
.second_services .content li {
/* width: 50%; */
flex-basis: calc(100% / 2);
}
}
/* STYLE FOR SERVICES */
.second_services html,
.second_services body,
.second_services div,
.second_services h1,
.second_services h2,
.second_services h3,
.second_services h4,
.second_services h5,
.second_services h6,
.second_services p,
.second_services ol,
.second_services ul,
.second_services li,
.second_services footer,
.second_services header,
.second_services hgroup,
.second_services menu,
.second_services nav,
{
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
.second_services html {
line-height: 1;
}
.second_services ol,
ul {
list-style: none;
}
.second_services table {
border-collapse: collapse;
border-spacing: 0;
}
.second_services caption,
th,
td {
text-align: left;
font-weight: normal;
vertical-align: middle;
}
.second_services q,
.second_services blockquote {
quotes: none;
}
.second_services q:before,
.second_services q:after,
.second_services blockquote:before,
.second_services blockquote:after {
content: "";
content: none;
}
.second_services a img {
border: none;
}
.second_services article,
.second_services aside,
.second_services details,
.second_services figcaption,
.second_services figure,
.second_services footer,
.second_services header,
.second_services hgroup,
.second_services menu,
.second_services nav,
.second_services section,
.second_services summary {
display: block;
}
/**
*
* Animate.css
* From : https://daneden.me/animate/
*
**/
.second_services .animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-ms-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
}
.second_services .animated.hinge {
-webkit-animation-duration: 2s;
-moz-animation-duration: 2s;
-ms-animation-duration: 2s;
-o-animation-duration: 2s;
animation-duration: 2s;
}
#-webkit-keyframes bounceIn {
0% {
opacity: 0;
-webkit-transform: scale(0.3);
}
50% {
opacity: 1;
-webkit-transform: scale(1.05);
}
70% {
-webkit-transform: scale(0.9);
}
100% {
-webkit-transform: scale(1);
}
}
#-moz-keyframes bounceIn {
0% {
opacity: 0;
-moz-transform: scale(0.3);
}
50% {
opacity: 1;
-moz-transform: scale(1.05);
}
70% {
-moz-transform: scale(0.9);
}
100% {
-moz-transform: scale(1);
}
}
#-o-keyframes bounceIn {
0% {
opacity: 0;
-o-transform: scale(0.3);
}
50% {
opacity: 1;
-o-transform: scale(1.05);
}
70% {
-o-transform: scale(0.9);
}
100% {
-o-transform: scale(1);
}
}
#keyframes bounceIn {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
opacity: 1;
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
.bounceIn {
-webkit-animation-name: bounceIn;
-moz-animation-name: bounceIn;
-o-animation-name: bounceIn;
animation-name: bounceIn;
}
#-webkit-keyframes bounceInUp {
0% {
opacity: 0;
-webkit-transform: translateY(2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(-30px);
}
80% {
-webkit-transform: translateY(10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes bounceInUp {
0% {
opacity: 0;
-moz-transform: translateY(2000px);
}
60% {
opacity: 1;
-moz-transform: translateY(-30px);
}
80% {
-moz-transform: translateY(10px);
}
100% {
-moz-transform: translateY(0);
}
}
#-o-keyframes bounceInUp {
0% {
opacity: 0;
-o-transform: translateY(2000px);
}
60% {
opacity: 1;
-o-transform: translateY(-30px);
}
80% {
-o-transform: translateY(10px);
}
100% {
-o-transform: translateY(0);
}
}
#keyframes bounceInUp {
0% {
opacity: 0;
transform: translateY(2000px);
}
60% {
opacity: 1;
transform: translateY(-30px);
}
80% {
transform: translateY(10px);
}
100% {
transform: translateY(0);
}
}
.second_services .bounceInUp {
-webkit-animation-name: bounceInUp;
-moz-animation-name: bounceInUp;
-o-animation-name: bounceInUp;
animation-name: bounceInUp;
}
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#-moz-keyframes bounceInDown {
0% {
opacity: 0;
-moz-transform: translateY(-2000px);
}
60% {
opacity: 1;
-moz-transform: translateY(30px);
}
80% {
-moz-transform: translateY(-10px);
}
100% {
-moz-transform: translateY(0);
}
}
#-o-keyframes bounceInDown {
0% {
opacity: 0;
-o-transform: translateY(-2000px);
}
60% {
opacity: 1;
-o-transform: translateY(30px);
}
80% {
-o-transform: translateY(-10px);
}
100% {
-o-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.second_services .bounceInDown {
-webkit-animation-name: bounceInDown;
-moz-animation-name: bounceInDown;
-o-animation-name: bounceInDown;
animation-name: bounceInDown;
}
#-webkit-keyframes bounceInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(30px);
}
80% {
-webkit-transform: translateX(-10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#-moz-keyframes bounceInLeft {
0% {
opacity: 0;
-moz-transform: translateX(-2000px);
}
60% {
opacity: 1;
-moz-transform: translateX(30px);
}
80% {
-moz-transform: translateX(-10px);
}
100% {
-moz-transform: translateX(0);
}
}
#-o-keyframes bounceInLeft {
0% {
opacity: 0;
-o-transform: translateX(-2000px);
}
60% {
opacity: 1;
-o-transform: translateX(30px);
}
80% {
-o-transform: translateX(-10px);
}
100% {
-o-transform: translateX(0);
}
}
#keyframes bounceInLeft {
0% {
opacity: 0;
transform: translateX(-2000px);
}
60% {
opacity: 1;
transform: translateX(30px);
}
80% {
transform: translateX(-10px);
}
100% {
transform: translateX(0);
}
}
.second_services .bounceInLeft {
-webkit-animation-name: bounceInLeft;
-moz-animation-name: bounceInLeft;
-o-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
#-webkit-keyframes bounceInRight {
0% {
opacity: 0;
-webkit-transform: translateX(2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(-30px);
}
80% {
-webkit-transform: translateX(10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#-moz-keyframes bounceInRight {
0% {
opacity: 0;
-moz-transform: translateX(2000px);
}
60% {
opacity: 1;
-moz-transform: translateX(-30px);
}
80% {
-moz-transform: translateX(10px);
}
100% {
-moz-transform: translateX(0);
}
}
#-o-keyframes bounceInRight {
0% {
opacity: 0;
-o-transform: translateX(2000px);
}
60% {
opacity: 1;
-o-transform: translateX(-30px);
}
80% {
-o-transform: translateX(10px);
}
100% {
-o-transform: translateX(0);
}
}
#keyframes bounceInRight {
0% {
opacity: 0;
transform: translateX(2000px);
}
60% {
opacity: 1;
transform: translateX(-30px);
}
80% {
transform: translateX(10px);
}
100% {
transform: translateX(0);
}
}
.second_services .bounceInRight {
-webkit-animation-name: bounceInRight;
-moz-animation-name: bounceInRight;
-o-animation-name: bounceInRight;
animation-name: bounceInRight;
}
#-webkit-keyframes rotateIn {
0% {
-webkit-transform-origin: center center;
-webkit-transform: rotate(-200deg);
opacity: 0;
}
100% {
-webkit-transform-origin: center center;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateIn {
0% {
-moz-transform-origin: center center;
-moz-transform: rotate(-200deg);
opacity: 0;
}
100% {
-moz-transform-origin: center center;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateIn {
0% {
-o-transform-origin: center center;
-o-transform: rotate(-200deg);
opacity: 0;
}
100% {
-o-transform-origin: center center;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateIn {
0% {
transform-origin: center center;
transform: rotate(-200deg);
opacity: 0;
}
100% {
transform-origin: center center;
transform: rotate(0);
opacity: 1;
}
}
.rotateIn {
-webkit-animation-name: rotateIn;
-moz-animation-name: rotateIn;
-o-animation-name: rotateIn;
animation-name: rotateIn;
}
#-webkit-keyframes rotateInUpLeft {
0% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInUpLeft {
0% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(90deg);
opacity: 0;
}
100% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInUpLeft {
0% {
-o-transform-origin: left bottom;
-o-transform: rotate(90deg);
opacity: 0;
}
100% {
-o-transform-origin: left bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInUpLeft {
0% {
transform-origin: left bottom;
transform: rotate(90deg);
opacity: 0;
}
100% {
transform-origin: left bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInUpLeft {
-webkit-animation-name: rotateInUpLeft;
-moz-animation-name: rotateInUpLeft;
-o-animation-name: rotateInUpLeft;
animation-name: rotateInUpLeft;
}
#-webkit-keyframes rotateInDownLeft {
0% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(-90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: left bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInDownLeft {
0% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(-90deg);
opacity: 0;
}
100% {
-moz-transform-origin: left bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInDownLeft {
0% {
-o-transform-origin: left bottom;
-o-transform: rotate(-90deg);
opacity: 0;
}
100% {
-o-transform-origin: left bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInDownLeft {
0% {
transform-origin: left bottom;
transform: rotate(-90deg);
opacity: 0;
}
100% {
transform-origin: left bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInDownLeft {
-webkit-animation-name: rotateInDownLeft;
-moz-animation-name: rotateInDownLeft;
-o-animation-name: rotateInDownLeft;
animation-name: rotateInDownLeft;
}
#-webkit-keyframes rotateInUpRight {
0% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(-90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInUpRight {
0% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(-90deg);
opacity: 0;
}
100% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInUpRight {
0% {
-o-transform-origin: right bottom;
-o-transform: rotate(-90deg);
opacity: 0;
}
100% {
-o-transform-origin: right bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInUpRight {
0% {
transform-origin: right bottom;
transform: rotate(-90deg);
opacity: 0;
}
100% {
transform-origin: right bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInUpRight {
-webkit-animation-name: rotateInUpRight;
-moz-animation-name: rotateInUpRight;
-o-animation-name: rotateInUpRight;
animation-name: rotateInUpRight;
}
#-webkit-keyframes rotateInDownRight {
0% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(90deg);
opacity: 0;
}
100% {
-webkit-transform-origin: right bottom;
-webkit-transform: rotate(0);
opacity: 1;
}
}
#-moz-keyframes rotateInDownRight {
0% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(90deg);
opacity: 0;
}
100% {
-moz-transform-origin: right bottom;
-moz-transform: rotate(0);
opacity: 1;
}
}
#-o-keyframes rotateInDownRight {
0% {
-o-transform-origin: right bottom;
-o-transform: rotate(90deg);
opacity: 0;
}
100% {
-o-transform-origin: right bottom;
-o-transform: rotate(0);
opacity: 1;
}
}
#keyframes rotateInDownRight {
0% {
transform-origin: right bottom;
transform: rotate(90deg);
opacity: 0;
}
100% {
transform-origin: right bottom;
transform: rotate(0);
opacity: 1;
}
}
.second_services .rotateInDownRight {
-webkit-animation-name: rotateInDownRight;
-moz-animation-name: rotateInDownRight;
-o-animation-name: rotateInDownRight;
animation-name: rotateInDownRight;
}
.second_services {
background: #31486f;
/* fallback for old browsers */
color: #fff;
font-family: 'Oswald', sans-serif;
}
/**
*
* Responsive list
*
**/
.second_services {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
height: 100vh;
}
.second_services .responsive {
width: 100%;
height: 100%;
display: flex;
}
.second_services .content {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex: 1 1 100%;
margin: 0;
padding: 0;
}
.second_services .content img {
width: 100%;
height: 101%;
}
.second_services .content li {
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
flex: 1 1 calc(100% / 3);
box-sizing: border-box;
height: 25%;
position: relative;
display: flex;
flex-wrap: wrap;
/* Colors Hover */
}
.content li:hover {
cursor: pointer;
}
.content li:hover .card-front {
-webkit-transform: rotateX(50deg);
-moz-transform: rotateX(50deg);
-ms-transform: rotateX(50deg);
-o-transform: rotateX(50deg);
transform: rotateX(50deg);
-webkit-transform: perspective(1000) rotateX(50deg);
-moz-transform: perspective(1000) rotateX(50deg);
-ms-transform: perspective(1000) rotateX(50deg);
-o-transform: perspective(1000) rotateX(50deg);
transform: perspective(1000) rotateX(50deg);
}
.content li:hover .card-back {
z-index: 950;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
-o-transform: rotateX(0deg);
transform: rotateX(0deg);
-webkit-transform: perspective(1000) rotateX(0deg);
-moz-transform: perspective(1000) rotateX(0deg);
-ms-transform: perspective(1000) rotateX(0deg);
-o-transform: perspective(1000) rotateX(0deg);
transform: perspective(1000) rotateX(0deg);
}
.content li:nth-child(n) .card-back {
background: #bea34d;
}
.content li:nth-child(1) h2,
.content li:nth-child(2) h2,
.content li:nth-child(3) h2 {
padding-top: 30px;
}
.content .card-front,
.content .card-back {
text-align: right;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 400ms;
-moz-transition: -moz-transform 400ms;
-o-transition: -o-transform 400ms;
transition: transform 400ms;
display: block;
height: 100%;
position: absolute;
width: 100%;
}
.content .card-front {
-webkit-transform: perspective(1000) rotateX(0);
-moz-transform: perspective(1000) rotateX(0);
-ms-transform: perspective(1000) rotateX(0);
-o-transform: perspective(1000) rotateX(0);
transform: perspective(1000) rotateX(0);
z-index: 900;
}
.content .card-back {
-webkit-transform: rotateX(-180deg);
-moz-transform: rotateX(-180deg);
-ms-transform: rotateX(-180deg);
-o-transform: rotateX(-180deg);
transform: rotateX(-180deg);
z-index: 800;
}
.content h2 {
font-size: 2vw;
;
float: right;
width: 100%;
margin-bottom: 10px;
text-transform: uppercase;
margin-right: 20px;
margin-top: 20px;
color: #ffffff;
}
.content h2 b {
float: right;
width: 100%;
}
.content p {
line-height: 1.3em;
color: white;
width: 90%;
float: right;
margin-right: 20px;
}
.second_services .close {
cursor: pointer;
position: absolute;
right: 0;
top: 0;
background: #fff;
color: #111;
text-decoration: none;
font-size: 20px;
padding: 10px 20px;
background-color: #31486f;
color: #ffffff;
opacity: 1;
font-weight: 100;
padding-top: 3%;
}
.second_services .active {
width: 100% !important;
height: 100% !important;
}
.active .all-content {
position: absolute;
left: 10px;
top: 20px;
margin-left: 5%;
margin-right: 5%;
margin-top: 5%;
}
.active .all-content h1 {
font-size: 20px;
width: 100%;
color: #ffffff;
}
/*
#media (min-width: 1366px)
{
.second_services .close {
margin-top: 3%;
}
}
#media (min-width: 440px) and (max-width: 750px) {
.second_services .content h2 {
font-size: 22px;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 33.1%;
}
}
#media (max-width: 439px) {
.second_services .content h2 {
font-size: 15px;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 33%;
}
}
#media (max-height: 450px) {
.second_services .content h2 {
font-size: 22px;
}
.second_services .content h2 b {
width: 100%;
}
.second_services .content li {
width: 33%;
}
}
*/
#media (max-width: 1024px) {
.content p {
font-size: 13px;
}
.second_services .content li {
flex-basis: calc(100% / 2);
}
}
#media (max-width: 439px) {
.content h2 {
font-size: 5vw;
}
.second_services .content p {
font-size: 13px;
}
.second_services .content li {
width: 100%;
}
}
<div class="second_services" id="second_services">
<div class="responsive">
<ul class="content">
<li>
<div class="card-front">
<h2><b>One front</b></h2>
</div>
<div class="card-back">
<h2><b>One back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Pomagamy na każdym etapie prowadzenia działalności. Doradzamy przy wyborze formy prawnej, załatwiamy wszystkie formalności związane z utworzeniem i rejestracją nowego podmiotu, pomagamy zorganizować Twoją działalność w zgodzie z obowiązującym
prawem.<br><br> Na kolejnym etapie dbamy o Twój komfort i bezpieczeństwo zapewniając skuteczne rozwiązania prawne dostosowane do Twoich potrzeb. Wykwalifikowany i doświadczony zespół pozwoli Ci zająć się tym co dla Ciebie najważniejsze - rozwijaniem
swojej działalności, bez potrzeby obawiania się o konsekwencje prawne swoich biznesowych decyzji.</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Two front</b></h2>
</div>
<div class="card-back">
<h2><b>Two back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Prawo rodzinne</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Three front</b></h2>
</div>
<div class="card-back">
<h2><b>Three back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>In vulputate sem a arcu semper</h1>
</div>
</li>
<!-- 2 -->
<li>
<div class="card-front">
<h2><b>Four front</b></h2>
</div>
<div class="card-back">
<h2><b>Four back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Etiam quis sapien interdum</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Five front</b></h2>
</div>
<div class="card-back">
<h2><b>Five back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Vivamus metus massa</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Six front</b></h2>
</div>
<div class="card-back">
<h2><b>Six back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Integer consequat vitae</h1>
</div>
</li>
<!-- 3 -->
<li>
<div class="card-front">
<h2><b>Seven front</b></h2>
</div>
<div class="card-back">
<h2><b>Seven back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Duis tellus dui vehicula</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Eight front</b></h2>
</div>
<div class="card-back">
<h2><b>Eight back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Ligula nulla tempus sem</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Nine fron</b></h2>
</div>
<div class="card-back">
<h2><b>Nine back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Ten front</b></h2>
</div>
<div class="card-back">
<h2><b>Ten back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Eleven front</b></h2>
</div>
<div class="card-back">
<h2><b>Eleven back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
<li>
<div class="card-front">
<h2><b>Twelve front</b></h2>
</div>
<div class="card-back">
<h2><b>Twelve back</b></h2>
</div>
<!-- Content -->
<div class="all-content" style="display: none;">
<h1>Class aptent taciti sociosqu</h1>
</div>
</li>
</ul>
</div>
</div>
Try to not mix flexbox with floats. You could also consider grid layout. Keeping your current html structure, I would do the following for minimal changes (see comments in css):
#second_services div.second_services {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
/* height: 100vh; Remove this*/
background: #31486f;
color: #fff;
}
.second_services .content {
/* float: left; Remove this */
width: 100%;
height: 100%;
/* Add the following three lines */
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.second_services .content li {
/* float: left; Remove this */
border-bottom: 1px solid #2c2c2c;
border-left: 1px solid #2c2c2c;
width: 33.2%;
height: 250px; /* Define a height: Could be with media queries */
position: relative;
display: flex;
flex-wrap: wrap;
}
Related
How to wrap iframe so it opens on click
I have an image which on hover displays the title of a video. I want to be able to click after hovering and have my iframe show up. I have been able to simply put the vimeo player in to pop up, but whenever I want to put the iframe in, it doesn't work. I understand I can't wrap it inside the tag but I don't know another solution. Right now if you input the code, on hover the iframe appears. I want for it to not appear on hover, but appear when I click. Any help would be appreciated. CODE: <style> .hoverfollow { position: fixed; } .hvrbox, .hvrbox * { box-sizing: border-box; } .hvrbox { position: relative; display: inline-block; overflow: hidden; width: 30%; height: auto; } .hvrbox img { max-width: 100%; } .hvrbox_background { width: 400px; height: 250px; background-size: cover; background-position: center center; background-repeat: no-repeat; } .hvrbox .hvrbox-layer_bottom { display: block; } .hvrbox .hvrbox-layer_top { text-decoration: none; opacity: 0; position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 15px; -moz-transition: all 0.4s ease-in-out 0s; -webkit-transition: all 0.4s ease-in-out 0s; -ms-transition: all 0.4s ease-in-out 0s; transition: all 0.4s ease-in-out 0s; } .hvrbox:hover .hvrbox-layer_top, .hvrbox.active .hvrbox-layer_top { opacity: 1; } .hvrbox .hvrbox-text { text-align: center; font-family: "DIN"; font-size: 10px; display: inline-block; position: absolute; top: 50%; left: 50%; -moz-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 100%; height: auto; } .hvrbox .hvrbox-text_mobile { font-size: 15px; border-top: 1px solid rgb(179, 179, 179); /* for old browsers */ border-top: 1px solid rgba(179, 179, 179, 0.7); margin-top: 5px; padding-top: 2px; display: none; } .hvrbox.active .hvrbox-text_mobile { display: block; } .hvrbox .hvrbox-layer_image { padding: 0; background: none; } .hvrbox .hvrbox-layer_slideup { -moz-transform: translateY(100%); -webkit-transform: translateY(100%); -ms-transform: translateY(100%); transform: translateY(100%); } .hvrbox:hover .hvrbox-layer_slideup, .hvrbox.active .hvrbox-layer_slideup { -moz-transform: translateY(0); -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .hvrbox .hvrbox-layer_slidedown { -moz-transform: translateY(-100%); -webkit-transform: translateY(-100%); -ms-transform: translateY(-100%); transform: translateY(-100%); } .hvrbox:hover .hvrbox-layer_slidedown, .hvrbox.active .hvrbox-layer_slidedown { -moz-transform: translateY(0); -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .hvrbox .hvrbox-layer_slideleft { -moz-transform: translateX(100%); -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); } .hvrbox:hover .hvrbox-layer_slideleft, .hvrbox.active .hvrbox-layer_slideleft { -moz-transform: translateX(0); -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .hvrbox .hvrbox-layer_slideright { -moz-transform: translateX(-100%); -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); } .hvrbox:hover .hvrbox-layer_slideright, .hvrbox.active .hvrbox-layer_slideright { -moz-transform: translateX(0); -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .hvrbox .hvrbox-layer_scale { border-radius: 50%; -moz-transform: scale(0); -webkit-transform: scale(0); -ms-transform: scale(0); transform: scale(0); } .hvrbox:hover .hvrbox-layer_scale, .hvrbox.active .hvrbox-layer_scale { border-radius: 0%; -moz-transform: scale(1); -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } .hvrbox .hvrbox-layer_rotate { border-radius: 50%; -moz-transform: rotateZ(0); -webkit-transform: rotateZ(0); -ms-transform: rotateZ(0); transform: rotateZ(0); } .hvrbox:hover .hvrbox-layer_rotate, .hvrbox.active .hvrbox-layer_rotate { border-radius: 0%; -moz-transform: rotateZ(360deg); -webkit-transform: rotateZ(360deg); -ms-transform: rotateZ(360deg); transform: rotateZ(360deg); } .hvrbox .hvrbox-layer_scale-rotate { border-radius: 50%; -moz-transform: scale(0) rotateZ(0); -webkit-transform: scale(0) rotateZ(0); -ms-transform: scale(0) rotateZ(0); transform: scale(0) rotateZ(0); } .hvrbox:hover .hvrbox-layer_scale-rotate, .hvrbox.active .hvrbox-layer_scale-rotate { border-radius: 0%; -moz-transform: scale(1) rotateZ(360deg); -webkit-transform: scale(1) rotateZ(360deg); -ms-transform: scale(1) rotateZ(360deg); transform: scale(1) rotateZ(360deg); } body, p, a, h1, h2, h3, h4, h5, h6, div { font-family: "DIN", sans-serif !important; margin: 0; text-decoration: none; } header { background: #009FDA none repeat scroll 0% 0%; box-shadow: 0px 0px 4px rgba(84, 84, 84, 0.5); padding: 5px 15px; color: #fff; text-align: center; overflow: hidden; } header img { height: 50px; float: left; } header h1 { text-transform: uppercase; font-weight: 400; font-size: 26px; line-height: 48px; } .content h1, .content h2, .content h3 { margin: 15px 0 0px 0; } .content { max-width: 1200px; margin: 50px auto 0 auto; width: 100%; } pre { background: #F2F2F2 none repeat scroll 0% 0%; font-size: 15px; padding: 10px; border-radius: 3px; margin: 10px 0; white-space: pre-wrap; -ms-tab-size: 4; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; } footer { background: #000; color: #fff; padding: 10px; font-size: 13px; } footer a { color: inherit; text-decoration: none; } footer a:hover, footer a:focus { text-decoration: underline; } .align { top: 5%; left: 5%; } iframe { width: 700px; /* adjust to your needs */ max-width: 100%; /* to make it responsive */ animation-name: fadeIn; animation-duration: 4s; } #amaka { width: 100%; height: auto; margin-top: 5%; animation-name: fadeIn; animation-duration: 4s; } </style> <main> <a class="align" href="test"> <div class="hvrbox align"> <img id="amaka" src="http://www.noscht.com/wp-content/uploads/2020/07/amaka.png" alt="AMAKA" class="hvrbox-layer_bottom"> <div class="hvrbox-layer_top"> <div class="hvrbox-text"> AMAKA QUEENETTE - "SUFFOCATE"</div>
Remove the source attribute of your IFrame and only set it onClick Give your IFrame a unique identifier so you can find it with document.getElementById(). <iframe id='myIframe' frameborder="0" scrolling="no" width="550" height="400"> The IFrame should then have a source. You can set the source for example like this: document.getElementById("myIframe").src = "https://yoursource.com" Now add this code inside the onClick attribute to your element you want the user to click on. onClick='document.getElementById("myIframe").src="https://yoursource.com" So your full HTML could look like this: <iframe id='myIframe' frameborder="0" scrolling="no" width="550" height="400"> <p onClick="document.getElementById("myIframe").src="https://yoursource.com"">Click here</p>
.hoverfollow { position: fixed; } .hvrbox, .hvrbox * { box-sizing: border-box; } .hvrbox { position: relative; display: inline-block; overflow: hidden; width: 30%; height: auto; } .hvrbox img { max-width: 100%; } .hvrbox_background { width: 400px; height: 250px; background-size: cover; background-position: center center; background-repeat: no-repeat; } .hvrbox .hvrbox-layer_bottom { display: block; } .hvrbox .hvrbox-layer_top { text-decoration: none; opacity: 0; position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 15px; -moz-transition: all 0.4s ease-in-out 0s; -webkit-transition: all 0.4s ease-in-out 0s; -ms-transition: all 0.4s ease-in-out 0s; transition: all 0.4s ease-in-out 0s; } .hvrbox:hover .hvrbox-layer_top, .hvrbox.active .hvrbox-layer_top { opacity: 1; } .hvrbox .hvrbox-text { text-align: center; font-family: "DIN"; font-size: 10px; display: inline-block; position: absolute; top: 50%; left: 50%; -moz-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 100%; height: auto; } .hvrbox .hvrbox-text_mobile { font-size: 15px; border-top: 1px solid rgb(179, 179, 179); /* for old browsers */ border-top: 1px solid rgba(179, 179, 179, 0.7); margin-top: 5px; padding-top: 2px; display: none; } .hvrbox.active .hvrbox-text_mobile { display: block; } .hvrbox .hvrbox-layer_image { padding: 0; background: none; } .hvrbox .hvrbox-layer_slideup { -moz-transform: translateY(100%); -webkit-transform: translateY(100%); -ms-transform: translateY(100%); transform: translateY(100%); } .hvrbox:hover .hvrbox-layer_slideup, .hvrbox.active .hvrbox-layer_slideup { -moz-transform: translateY(0); -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .hvrbox .hvrbox-layer_slidedown { -moz-transform: translateY(-100%); -webkit-transform: translateY(-100%); -ms-transform: translateY(-100%); transform: translateY(-100%); } .hvrbox:hover .hvrbox-layer_slidedown, .hvrbox.active .hvrbox-layer_slidedown { -moz-transform: translateY(0); -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } .hvrbox .hvrbox-layer_slideleft { -moz-transform: translateX(100%); -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); } .hvrbox:hover .hvrbox-layer_slideleft, .hvrbox.active .hvrbox-layer_slideleft { -moz-transform: translateX(0); -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .hvrbox .hvrbox-layer_slideright { -moz-transform: translateX(-100%); -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); } .hvrbox:hover .hvrbox-layer_slideright, .hvrbox.active .hvrbox-layer_slideright { -moz-transform: translateX(0); -webkit-transform: translateX(0); -ms-transform: translateX(0); transform: translateX(0); } .hvrbox .hvrbox-layer_scale { border-radius: 50%; -moz-transform: scale(0); -webkit-transform: scale(0); -ms-transform: scale(0); transform: scale(0); } .hvrbox:hover .hvrbox-layer_scale, .hvrbox.active .hvrbox-layer_scale { border-radius: 0%; -moz-transform: scale(1); -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } .hvrbox .hvrbox-layer_rotate { border-radius: 50%; -moz-transform: rotateZ(0); -webkit-transform: rotateZ(0); -ms-transform: rotateZ(0); transform: rotateZ(0); } .hvrbox:hover .hvrbox-layer_rotate, .hvrbox.active .hvrbox-layer_rotate { border-radius: 0%; -moz-transform: rotateZ(360deg); -webkit-transform: rotateZ(360deg); -ms-transform: rotateZ(360deg); transform: rotateZ(360deg); } .hvrbox .hvrbox-layer_scale-rotate { border-radius: 50%; -moz-transform: scale(0) rotateZ(0); -webkit-transform: scale(0) rotateZ(0); -ms-transform: scale(0) rotateZ(0); transform: scale(0) rotateZ(0); } .hvrbox:hover .hvrbox-layer_scale-rotate, .hvrbox.active .hvrbox-layer_scale-rotate { border-radius: 0%; -moz-transform: scale(1) rotateZ(360deg); -webkit-transform: scale(1) rotateZ(360deg); -ms-transform: scale(1) rotateZ(360deg); transform: scale(1) rotateZ(360deg); } body, p, a, h1, h2, h3, h4, h5, h6, div { font-family: "DIN", sans-serif !important; margin: 0; text-decoration: none; } header { background: #009FDA none repeat scroll 0% 0%; box-shadow: 0px 0px 4px rgba(84, 84, 84, 0.5); padding: 5px 15px; color: #fff; text-align: center; overflow: hidden; } header img { height: 50px; float: left; } header h1 { text-transform: uppercase; font-weight: 400; font-size: 26px; line-height: 48px; } .content h1, .content h2, .content h3 { margin: 15px 0 0px 0; } .content { max-width: 1200px; margin: 50px auto 0 auto; width: 100%; } pre { background: #F2F2F2 none repeat scroll 0% 0%; font-size: 15px; padding: 10px; border-radius: 3px; margin: 10px 0; white-space: pre-wrap; -ms-tab-size: 4; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; } footer { background: #000; color: #fff; padding: 10px; font-size: 13px; } footer a { color: inherit; text-decoration: none; } footer a:hover, footer a:focus { text-decoration: underline; } .align { top: 5%; left: 5%; } iframe { width: 700px; /* adjust to your needs */ max-width: 100%; /* to make it responsive */ animation-name: fadeIn; animation-duration: 4s; } #amaka { width: 100%; height: auto; margin-top: 5%; animation-name: fadeIn; animation-duration: 4s; } #myIframe {} <main> <div class="hvrbox align"> <img id="amaka" src="http://www.noscht.com/wp-content/uploads/2020/07/amaka.png" alt="AMAKA" class="hvrbox-layer_bottom"> <a href="#"> <div onClick='document.getElementById("myIframe").src="https://player.vimeo.com/video/389137312"' class="hvrbox-layer_top"></div> </a> <div class="hvrbox-text"> AMAKA QUEENETTE - "SUFFOCATE"</div> <iframe id="myIframe" onClick="https://player.vimeo.com/video/389137312" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> </div> </main>
Why does my website have the white box at the bottom?
Basically I have a website that has a section with a white bar at the bottom. I don't know how to get rid of it. Yes I know that others have asked this question, however I don't want a bar that won't work with my image. Any ideas? Also, I am using two css files. I separated them with comments, so hopefully it won't be two confusing which code is from which file /*first file*/ * { margin: 0; padding: 0; border: 0 none; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; } html { font-size: 10px; font-family: "Roboto Cn", sans-serif; } body { -ms-overflow-x: hidden; overflow-x: hidden; } a { text-decoration: none; color: #eee; } header { width: 100%; height: 100vh; background: -webkit-linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.5)), url("../images/gafd.png") center top no-repeat; background: -o-linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.5)), url("https://img00.deviantart.net/a06b/i/2018/116/b/f/goldenadrien_and_friends_family_diner_v_2_by_goldenadrien-dc9xvji.png") center top no-repeat; background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.5)), url("https://img00.deviantart.net/a06b/i/2018/116/b/f/goldenadrien_and_friends_family_diner_v_2_by_goldenadrien-dc9xvji.png") center top no-repeat; background-size: cover; } p { position: relative; text-align: center; font-family: 'Roboto Cn', sans-serif; font-size: 50px; top: 50%; left: 0; text-shadow: 0 0 3px #FF0000, 0 0 5px yellow; z-index:2; } .container { max-width: 120rem; width: 90%; margin: 0 auto; } nav { padding-top: 5rem; display: flex; display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between; -moz-justify-content: space-between; align-items: center; -webkit-align-items: center; text-transform: uppercase; font-size: 1.6rem; } .brand { font-size: 3rem; font-weight: 300; -webkit-transform: translateX(-1000px); -o-transform: translateX(-1000px); -moz-transform: translateX(-1000px); -ms-transform: translateX(-1000px); transform: translateX(-1000px); -webkit-animation: slideIn 0.5s forwards; -o-animation: slideIn 0.5s forwards; -moz-animation: slideIn 0.5s forwards; animation: slideIn 0.5s forwards; } .brand .textgradient { font-size: 3rem; font-weight: 300; background: -webkit-linear-gradient(to left, goldenrod, yellow, goldenrod, yellow); background: -o-linear-gradient(to left, goldenrod, yellow, goldenrod, yellow); background: linear-gradient(to left, goldenrod, yellow, goldenrod, yellow); background-size: 400%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-animation: textGradient 4s linear infinite; -o-animation: textGradient 4s linear infinite; -moz-animation: textGradient 4s linear infinite; animation: textGradient 4s linear infinite; } #-webkit-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #-o-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #-moz-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } .brand .textgradient2 { font-size: 3rem; font-weight: 300; background: -webkit-linear-gradient(to right, darkred, #F80F01, darkred, #F80F01); background: -o-linear-gradient(to right, darkred, #F80F01, darkred, #F80F01); background: linear-gradient(to right, darkred, #F80F01, darkred, #F80F01); background-size: 400%; background-position: 0%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-animation: textGradient 4s linear infinite; -o-animation: textGradient 4s linear infinite; -moz-animation: textGradient 4s linear infinite; animation: textGradient 4s linear infinite; } .brand .textgradient3 { font-size: 3rem; font-weight: 300; background: -webkit-linear-gradient(to right, #0036DA, navy, #0036DA, navy); background: -o-linear-gradient(to right, #0036DA, navy, #0036DA, navy); background: linear-gradient(to right, #0036DA, navy, #0036DA, navy); background-size: 400%; background-position: 0%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-animation: textGradient 4s linear infinite; -o-animation: textGradient 4s linear infinite; -moz-animation: textGradient 4s linear infinite; animation: textGradient 4s linear infinite; } #-webkit-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #-o-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #-moz-keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } #keyframes textGradient { 0% { background-position: 0%; } 100% { background-position: 90%; } } nav ul { display: flex; display: -webkit-flex; } nav ul li.linav { list-style: none; -webkit-transform: translateX(1000px); -o-transform: translateX(1000px); -moz-transform: translateX(1000px); -ms-transform: translateX(1000px); transform: translateX(1000px); -webkit-animation: slideIn 0.5s forwards; -o-animation: slideIn 0.5s forwards; -moz-animation: slideIn 0.5s forwards; animation: slideIn 0.5s forwards; } nav ul li.linav:nth-child(1) { -webkit-animation-delay: 0; -o-animation-delay: 0; -moz-animation-delay: 0; animation-delay: 0; } nav ul li.linav:nth-child(2) { -webkit-animation-delay: 0.5s; -o-animation-delay: 0.5s; -moz-animation-delay: 0.5s; animation-delay: 0.5s; } nav ul li.linav:nth-child(3) { -webkit-animation-delay: 1s; -o-animation-delay: 1s; -moz-animation-delay: 1s; animation-delay: 1s; } nav ul li.linav:nth-child(4) { -webkit-animation-delay: 1.5s; -o-animation-delay: 1.5s; -moz-animation-delay: 1.5s; animation-delay: 1.5s; } nav ul li.linav a { padding: 1rem 0; margin: 0 3rem; position: relative; letter-spacing: 2px; } nav ul li.linav a:last-child { margin-right: 0; } nav ul li.linav a:before, nav ul li.linav a:after { content: ''; position: absolute; width: 100%; height: 2px; left: 0; background-color: gold; -webkit-transform: scaleX(0); -o-transform: scaleX(0); -moz-transform: scaleX(0); -ms-transform: scaleX(0); transform: scaleX(0); -webkit-transition: all .5s; -o-transition: all .5s; -moz-transition: all .5s; transition: all .5s; } nav ul li.linav:nth-child(1) a:before, nav ul li.linav:nth-child(1) a:after { content: ''; position: absolute; width: 100%; height: 2px; background: linear-gradient(to right, goldenrod, yellow); background-color: crimson; } nav ul li.linav:nth-child(2) a:before, nav ul li.linav:nth-child(2) a:after { content: ''; position: absolute; width: 100%; height: 2px; background: linear-gradient(to right, darkred, #F80F01); } nav ul li.linav:nth-child(3) a:before, nav ul li.linav:nth-child(3) a:after { content: ''; position: absolute; width: 100%; height: 2px; background: linear-gradient(to right, #0036DA, navy); } nav ul li.linav:nth-child(4) a:before { content: ''; position: absolute; width: 100%; height: 2px; background: linear-gradient(to right, darkred, #F80F01); } nav ul li.linav:nth-child(4) a:after { content: ''; position: absolute; width: 100%; height: 2px; background: linear-gradient(to right, navy, #0036DA) } nav ul li.linav a:before { top: 0; -webkit-transform-origin: left; -o-transform-origin: left; -moz-transform-origin: left; -ms-transform-origin: left; transform-origin: left; } nav ul li.linav a:after { bottom: 0; -webkit-transform-origin: right; -o-transform-origin: right; -moz-transform-origin: right; -ms-transform-origin: right; transform-origin: right; } nav ul li.linav a:hover:before, nav ul li.linav a:hover:after { -webkit-transform: scaleX(1); -o-transform: scaleX(1); -moz-transform: scaleX(1); -ms-transform: scaleX(1); transform: scaleX(1); } #-webkit-keyframes slideIn { from { } to { -webkit-transform: translateX(0); transform: translateX(0); } } /*second file*/ .c { margin: 0; padding: 0; display: -webkit-flex; display: flex; -webkit-justify-content: center; justify-content: center; -webkit-align-items: center; align-items: center; min-height: 100vh; } ul { margin: 0; padding: 0; display: -webkit-flex; display: flex; } ul li.b { z-index:0; position: relative; list-style: none; width: 100px; height: 100px; margin: 0 10px; -webkit-border-radius: 50%; border-radius: 50%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } ul li.b:before, ul li.b:after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; -webkit-border-radius: 50%; border-radius: 50%; -webkit-filter: blur(20px); filter: blur(20px); opacity: 0; -webkit-transition: 1s; -o-transition: 1s; -moz-transition: 1s; transition: 1s; z-index: -1; } ul li.b:after { -webkit-filter: blur(40px); filter: blur(40px); } ul li.b:hover:before, ul li.b:hover:after { opacity: 1; } ul li.b a { position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; text-align: center; line-height: 80px; color: #fff; background: #000; font-size: 36px; -webkit-border-radius: 50%; border-radius: 50%; } ul li.b a .fab { text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); -webkit-transition: 0.5s; -o-transition: 0.5s; -moz-transition: 0.5s; transition: 0.5s; -webkit-transform: rotateY(0deg) scale(0.8); -ms-transform: rotateY(0deg) scale(0.8); -o-transform: rotateY(0deg) scale(0.8); -moz-transform: rotateY(0deg) scale(0.8); transform: rotateY(0deg) scale(0.8); opacity: 0.2; } ul li.b a:hover .fab { opacity: 1; -webkit-transform: scale(1.2); -ms-transform: scale(1.2); -o-transform: scale(1.2); -moz-transform: scale(1.2); transform: scale(1.2); } ul li.b:nth-child(1) a, ul li.b:nth-child(1):before, ul li.b:nth-child(1):after { background: linear-gradient(45deg, #adc0b3, #1dc200); } ul li.b:nth-child(2) a, ul li.b:nth-child(2):before, ul li.b:nth-child(2):after { background: linear-gradient(45deg, #7289da, #053bff); } ul li.b:nth-child(3) a, ul li.b:nth-child(3):before, ul li.b:nth-child(3):after { background: linear-gradient(45deg, #ff3863, #f10); } ul li.b:nth-child(4) a, ul li.b:nth-child(4):before, ul li.b:nth-child(4):after { background: linear-gradient(45deg, #f0d, #90f); } .glitch { font-size: 130px; line-height: 1; font-family: 'Poppins', sans-serif; font-weight: 700; position: absolute; top: 80%; left: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); transform: translate(-50%, -50%); margin: 0; text-decoration: none; color: #fff; } .glitch:before, .glitch:after { display:block; content: 'Discord Server Link Is Currently Unavailable.'; position: absolute; top: 0; left: 0; height: 100%; width: 100%; opacity: 0.8; } .glitch:after { color: #f0f; z-index: -2; } .glitch:before { color: #0ff; z-index: -1; } .glitch:before { -webkit-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; -moz-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; } .glitch:after { -webkit-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; -moz-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; } #-webkit-keyframes glitch { 0% { -webkit-transform: translate(0px); transform: translate(0px); } 20% { -webkit-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -webkit-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -webkit-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -webkit-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -webkit-transform: translate(0px); transform: translate(0px); } } #-moz-keyframes glitch { 0% { -moz-transform: translate(0px); transform: translate(0px); } 20% { -moz-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -moz-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -moz-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -moz-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -moz-transform: translate(0px); transform: translate(0px); } } #-o-keyframes glitch { 0% { -o-transform: translate(0px); transform: translate(0px); } 20% { -o-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -o-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -o-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -o-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -o-transform: translate(0px); transform: translate(0px); } } #-moz-keyframes glitch { 0% { -moz-transform: translate(0px); transform: translate(0px); } 20% { -moz-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -moz-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -moz-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -moz-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -moz-transform: translate(0px); transform: translate(0px); } } #keyframes glitch { 0% { transform: translate(0px); } 20% { transform: translate(-5px, 5px); } 40% { transform: translate(-5px, -5px); } 60% { transform: translate(5px, 5px); } 80% { transform: translate(5px, -5px); } 100% { transform: translate(0px); } } .glitch { font-size: 25px; line-height: 1; font-family: 'Poppins', sans-serif; font-weight: 100; position: absolute; bottom:10px; left: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); transform: translate(-50%, -50%); margin: 0; text-decoration: none; color: #fff; } .glitch:before, .glitch:after { display:block; content: 'Discord Server Link Is Currently Unavailable'; position: absolute; top: 0; left: 0; height: 100%; width: 100%; opacity: 0.8; } .glitch:after { color: #f0f; z-index: -2; } .glitch:before { color: #0ff; z-index: -1; } .glitch:before { -webkit-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; -moz-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite; } .glitch:after { -webkit-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; -moz-animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite; } #-webkit-keyframes glitch { 0% { -webkit-transform: translate(0px); transform: translate(0px); } 20% { -webkit-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -webkit-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -webkit-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -webkit-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -webkit-transform: translate(0px); transform: translate(0px); } } #-o-keyframes glitch { 0% { -o-transform: translate(0px); transform: translate(0px); } 20% { -o-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -o-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -o-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -o-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -o-transform: translate(0px); transform: translate(0px); } } #-moz-keyframes glitch { 0% { -moz-transform: translate(0px); transform: translate(0px); } 20% { -moz-transform: translate(-5px, 5px); transform: translate(-5px, 5px); } 40% { -moz-transform: translate(-5px, -5px); transform: translate(-5px, -5px); } 60% { -moz-transform: translate(5px, 5px); transform: translate(5px, 5px); } 80% { -moz-transform: translate(5px, -5px); transform: translate(5px, -5px); } 100% { -moz-transform: translate(0px); transform: translate(0px); } } #keyframes glitch { 0% { transform: translate(0px); } 20% { transform: translate(-5px, 5px); } 40% { transform: translate(-5px, -5px); } 60% { transform: translate(5px, 5px); } 80% { transform: translate(5px, -5px); } 100% { transform: translate(0px); } } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>GoldenAdrien's Social Accounts</title> <link rel="stylesheet" href="css/home.css" type='text/css'> <link rel='stylesheet' type='text/css' href='css/style.css'> <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous"> </head> <body> <header> <div class="container"> <nav> <h1 class="brand"><a class='nav' href="index"><span class="textgradient">Golden</span><span class="textgradient2">Adr</span><span class="textgradient3">ien</span></a></h1> <ul class="ulnav"> <li class="linav"><a class='nav' href="index">Home</a></li> <li class="linav"><a class='nav2' href="#">Social Links</a></li> <li class="linav"><a class='nav3' href="#">Programs</a></li> <li class="linav"><a class='nav4' href="#">Contact Me</a></li> </ul> </nav> </div> <div class='c'> <ul> <li class='b'><i class="fab fa-deviantart" aria-hidden="true"></i></li> <li class='b'><i class="fab fa-discord" aria-hidden="true"></i></li> <li class='b'><i class="fab fa-youtube" aria-hidden="true"></i></li> <li class='b'><i class="fab fa-github" aria-hidden="true"></i></li> </ul> Discord Server Link Is Currently Unavailable. </div> </header> </body> </html>
Scaling messes up the z-index
I have a set of absolute divs having background images which contains animation. when i apply scale property to the divs it messes up my z-index totally here is the link to the fiddle https://jsfiddle.net/kq2soozp/3/ (Uncomment transform:scale() line) The HTML Code <div class='me'> <div class="torso"> <div class="left leg"> <div class="left thigh"> <div class="left shin"> <div class="left foot"> <div class="left toes"></div> </div> </div> </div> </div> <div class="right leg"> <div class="right thigh"> <div class="right shin"> <div class="right foot"> <div class="right toes"></div> </div> </div> </div> </div> <div class="left arm"> <div class="left bicep"> <div class="left forearm"> <div class="kite"></div> </div> </div> </div> <div class="right arm"> <div class="right bicep"> <div class="right forearm"></div> </div> </div> </div> </div> The CSS .me,.me div{ background-repeat: no-repeat; position: absolute; -webkit-animation-duration: 2000ms; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: linear; //-webkit-transform: scale(0.9); } .me{ top: 80px; left: 350px; -webkit-animation-name: me; } .torso{ height: 274px; width: 86px; background-image: url("https://s9.postimg.org/41xfy5cin/torso.png"); } .arm{ left: 12px; -webkit-transform-origin: 20px 10px; } .kite{ width: 395px; height: 424px; top: -115px; left: 0px; background-image: url("https://s3.postimg.org/ix240ioab/kite.png"); -webkit-transform: rotate(45deg) scale(0.6); } .right.bicep{ width: 51px; height: 124px; background-image: url("https://s3.postimg.org/mlrszzyb7/right-bicep.png"); } .left.bicep{ width: 52px; : 126px; background-image: url("https://s3.postimg.org/jb3g048dv/left-bicep.png"); } .left.forearm{ width: 37px; height: 124px; background-image: url("https://s3.postimg.org/7ahzze0z7/left-forearm.png"); -webkit-transform: rotate(-45deg); } .right.forearm{ width: 36px; height: 121px; background-image: url("https://s3.postimg.org/q6noj82ur/right-forearm.png"); -webkit-animation-name: right-forearm; } .left.thigh{ width: 69px; height: 144px; background-image: url("https://s3.postimg.org/577krq16b/left-thigh.png"); } .right.thigh{ width: 69px; height: 144px; background-image: url("https://s3.postimg.org/72ud2vq0j/right-thigh.png"); } .shin{ width: 53px; height: 173px; background-image: url("https://s3.postimg.org/3xecqews3/shin.png"); } .foot{ width: 67px; height: 34px; background-image: url("https://s3.postimg.org/l0cj86o37/foot.png"); } .toes{ width: 28px; height: 25px; background-image: url("https://s3.postimg.org/vm0zxxjsj/toes.png"); } .right.arm{ top: 93px; -webkit-animation-name: right-bicep; } .left.arm{ top: 87px; -webkit-transform: rotate(-26deg); } .forearm{ top: 108px; left: 14px; -webkit-transform-origin: 3px 7px; } .leg{ left: 6px; -webkit-transform-origin: 30px 20px; -webkit-animation-name: thigh; } .right.leg{ top: 235px; -webkit-animation-name: right-thigh; } .left.leg{ top:225px; -webkit-animation-name: left-thigh; } .shin{ top: 115px; -webkit-transform-origin: 30px 25px; } .right.shin { -webkit-animation-name: right-shin; } .left.shin { -webkit-animation-name: left-shin; } .foot{ top: 155px; left: 2px; -webkit-transform-origin: 0 50%; } .right.foot { -webkit-animation-name: right-foot; } .left.foot { -webkit-animation-name: left-foot; } .toes{ top: 9px; left: 66px; -webkit-transform-origin: 0% 100%; } .right.toes { -webkit-animation-name: right-toes; } .left.toes { -webkit-animation-name: left-toes; } div.right.arm { z-index: 1; } div.left.arm { z-index: -3; } div.arm > div.bicep > div.forearm { z-index: -1; } div.right.leg { z-index: -1; } div.left.leg { z-index: -2; } div.leg > div.thigh > div.shin { z-index: -1; } #-webkit-keyframes me { 0% { -webkit-transform: rotate(5deg) translate( 10px, 0px); } 25% { -webkit-transform: rotate(5deg) translate(-5px, -14px); } 50% { -webkit-transform: rotate(5deg) translate( 10px, 0px); } 75% { -webkit-transform: rotate(5deg) translate(-5px, -14px); } 100% { -webkit-transform: rotate(5deg) translate( 10px, 0px); } } #-webkit-keyframes right-bicep { 0% { -webkit-transform: rotate(26deg); } 50% { -webkit-transform: rotate(-20deg); } 100% { -webkit-transform: rotate(26deg); } } /*#-webkit-keyframes left-bicep { 0% { -webkit-transform: rotate(-20deg); } 50% { -webkit-transform: rotate(26deg); } 100% { -webkit-transform: rotate(-20deg); } }*/ #-webkit-keyframes right-forearm { 0% { -webkit-transform: rotate(-10deg); } 50% { -webkit-transform: rotate(-65deg); } 100% { -webkit-transform: rotate(-10deg); } } /*#-webkit-keyframes left-forearm { 0% { -webkit-transform: rotate(-45deg); } 50% { -webkit-transform: rotate(-10deg); } 100% { -webkit-transform: rotate(-45deg); } }*/ #-webkit-keyframes right-thigh { 0% { -webkit-transform: rotate(-45deg); } 50% { -webkit-transform: rotate(10deg); } 100% { -webkit-transform: rotate(-45deg); } } #-webkit-keyframes left-thigh { 0% { -webkit-transform: rotate(10deg); } 50% { -webkit-transform: rotate(-45deg); } 100% { -webkit-transform: rotate(10deg); } } #-webkit-keyframes right-shin { 0% { -webkit-transform: rotate(30deg); } 25% { -webkit-transform: rotate(20deg); } 50% { -webkit-transform: rotate(20deg); } 75% { -webkit-transform: rotate(85deg); } 100% { -webkit-transform: rotate(30deg); } } #-webkit-keyframes left-shin { 0% { -webkit-transform: rotate(20deg); } 25% { -webkit-transform: rotate(85deg); } 50% { -webkit-transform: rotate(30deg); } 75% { -webkit-transform: rotate(20deg); } 100% { -webkit-transform: rotate(20deg); } } #-webkit-keyframes right-foot { 0% { -webkit-transform: rotate(-5deg); } 25% { -webkit-transform: rotate(-7deg); } 50% { -webkit-transform: rotate(-16deg); } 75% { -webkit-transform: rotate(-10deg); } 100% { -webkit-transform: rotate(-5deg); } } #-webkit-keyframes left-foot { 0% { -webkit-transform: rotate(-16deg); } 25% { -webkit-transform: rotate(-10deg); } 50% { -webkit-transform: rotate(-5deg); } 75% { -webkit-transform: rotate(-7deg); } 100% { -webkit-transform: rotate(-16deg); } } #-webkit-keyframes right-toes { 0% { -webkit-transform: rotate(0deg); } 25% { -webkit-transform: rotate(-10deg); } 50% { -webkit-transform: rotate(-10deg); } 75% { -webkit-transform: rotate(-25deg); } 100% { -webkit-transform: rotate(0deg); } } #-webkit-keyframes left-toes { 0% { -webkit-transform: rotate(-10deg); } 25% { -webkit-transform: rotate(-25deg); } 50% { -webkit-transform: rotate(0deg); } 75% { -webkit-transform: rotate(-10deg); } 100% { -webkit-transform: rotate(-10deg); } } Please help me solve this issue. I looked into the other post about this problem but I am not able to correct it. Thank you
You can read this one z-index is canceled by setting transform(rotate) basically, transforming an element using 'transform' which gives the element its own stacking context that is different than other element which is not transformed. What you can do is make all element to transform, for example: <div class="a"><img src="..."></div> <div class="b"><img src="..."></div> you want div 'a' to scale(0.9) and be on top of 'b'. you can make the div 'b' to transform to translate(0,0) or scale(0) which won't make any different. Or you can just transform the content inside of it (for my example it's an image element) instead of the div that wrapping it. then just apply the z-index to div.
Since the transform property resets the stacking order of the elements, what i did is a wrapper div to the class "me" and apply transform scale property to the wrapper to reduce the size .wrapper{ -webkit-transform: scale(0.4); } here is the link to the working fiddle https://jsfiddle.net/kq2soozp/5/
It's not the z-index that is getting messed up, it's the relative size of the inner divs in relation to the main .me div. You resize .me to 90% of its original size, and then resize all the divs inside as well, so they end up at 81% of their original sizes. Solution: apply the scale only to the .me and not to the divs in it. .wrapper { position: relative; } .me, .me div { background-repeat: no-repeat; position: absolute; animation-duration: 2000ms; animation-iteration-count: infinite; animation-timing-function: linear; } .me { top: 80px; left: 350px; transform: scale(0.9); /* moved here */ } .torso { height: 274px; width: 86px; background-image: url("https://s9.postimg.org/41xfy5cin/torso.png"); } .arm { left: 12px; transform-origin: 20px 10px; } .kite { width: 395px; height: 424px; top: -115px; left: 0px; background-image: url("https://s3.postimg.org/ix240ioab/kite.png"); transform: rotate(45deg) scale(0.6); } .right.bicep { width: 51px; height: 124px; background-image: url("https://s3.postimg.org/mlrszzyb7/right-bicep.png"); } .left.bicep { width: 52px; height: 126px; background-image: url("https://s3.postimg.org/jb3g048dv/left-bicep.png"); } .left.forearm { width: 37px; height: 124px; background-image: url("https://s3.postimg.org/7ahzze0z7/left-forearm.png"); transform: rotate(-45deg); } .right.forearm { width: 36px; height: 121px; background-image: url("https://s3.postimg.org/q6noj82ur/right-forearm.png"); animation-name: right-forearm; } .left.thigh { width: 69px; height: 144px; background-image: url("https://s3.postimg.org/577krq16b/left-thigh.png"); } .right.thigh { width: 69px; height: 144px; background-image: url("https://s3.postimg.org/72ud2vq0j/right-thigh.png"); } .shin { width: 53px; height: 173px; background-image: url("https://s3.postimg.org/3xecqews3/shin.png"); } .foot { width: 67px; height: 34px; background-image: url("https://s3.postimg.org/l0cj86o37/foot.png"); } .toes { width: 28px; height: 25px; background-image: url("https://s3.postimg.org/vm0zxxjsj/toes.png"); } .right.arm { top: 93px; animation-name: right-bicep; } .left.arm { top: 87px; transform: rotate(-26deg); } .forearm { top: 108px; left: 14px; transform-origin: 3px 7px; } .leg { left: 6px; transform-origin: 30px 20px; animation-name: thigh; } .right.leg { top: 235px; animation-name: right-thigh; } .left.leg { top: 225px; animation-name: left-thigh; } .shin { top: 115px; transform-origin: 30px 25px; } .right.shin { animation-name: right-shin; } .left.shin { animation-name: left-shin; } .foot { top: 155px; left: 2px; transform-origin: 0 50%; } .right.foot { animation-name: right-foot; } .left.foot { animation-name: left-foot; } .toes { top: 9px; left: 66px; transform-origin: 0% 100%; } .right.toes { animation-name: right-toes; } .left.toes { animation-name: left-toes; } div.right.arm { z-index: 1; } div.left.arm { z-index: -3; } div.arm>div.bicep>div.forearm { z-index: -1; } div.right.leg { z-index: -1; } div.left.leg { z-index: -2; } div.leg>div.thigh>div.shin { z-index: -1; } #keyframes me { 0% { transform: rotate(5deg) translate( 5px, 0px); } 25% { transform: rotate(5deg) translate(-5px, -14px); } 50% { transform: rotate(5deg) translate( 5px, 0px); } 75% { transform: rotate(5deg) translate(-5px, -14px); } 100% { transform: rotate(5deg) translate( 5px, 0px); } } #keyframes right-bicep { 0% { transform: rotate(26deg); } 50% { transform: rotate(-20deg); } 100% { transform: rotate(26deg); } } /*#keyframes left-bicep { 0% { transform: rotate(-20deg); } 50% { transform: rotate(26deg); } 100% { transform: rotate(-20deg); } }*/ #keyframes right-forearm { 0% { transform: rotate(-10deg); } 50% { transform: rotate(-65deg); } 100% { transform: rotate(-10deg); } } /*#keyframes left-forearm { 0% { transform: rotate(-45deg); } 50% { transform: rotate(-10deg); } 100% { transform: rotate(-45deg); } }*/ #keyframes right-thigh { 0% { transform: rotate(-45deg); } 50% { transform: rotate(10deg); } 100% { transform: rotate(-45deg); } } #keyframes left-thigh { 0% { transform: rotate(10deg); } 50% { transform: rotate(-45deg); } 100% { transform: rotate(10deg); } } #keyframes right-shin { 0% { transform: rotate(30deg); } 25% { transform: rotate(20deg); } 50% { transform: rotate(20deg); } 75% { transform: rotate(85deg); } 100% { transform: rotate(30deg); } } #keyframes left-shin { 0% { transform: rotate(20deg); } 25% { transform: rotate(85deg); } 50% { transform: rotate(30deg); } 75% { transform: rotate(20deg); } 100% { transform: rotate(20deg); } } #keyframes right-foot { 0% { transform: rotate(-5deg); } 25% { transform: rotate(-7deg); } 50% { transform: rotate(-16deg); } 75% { transform: rotate(-10deg); } 100% { transform: rotate(-5deg); } } #keyframes left-foot { 0% { transform: rotate(-16deg); } 25% { transform: rotate(-10deg); } 50% { transform: rotate(-5deg); } 75% { transform: rotate(-7deg); } 100% { transform: rotate(-16deg); } } #keyframes right-toes { 0% { transform: rotate(0deg); } 25% { transform: rotate(-10deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(-25deg); } 100% { transform: rotate(0deg); } } #keyframes left-toes { 0% { transform: rotate(-10deg); } 25% { transform: rotate(-25deg); } 50% { transform: rotate(0deg); } 75% { transform: rotate(-10deg); } 100% { transform: rotate(-10deg); } } <div class="wrapper"> <div class='me'> <div class="torso"> <div class="left leg"> <div class="left thigh"> <div class="left shin"> <div class="left foot"> <div class="left toes"></div> </div> </div> </div> </div> <div class="right leg"> <div class="right thigh"> <div class="right shin"> <div class="right foot"> <div class="right toes"></div> </div> </div> </div> </div> <div class="left arm"> <div class="left bicep"> <div class="left forearm"> <div class="kite"></div> </div> </div> </div> <div class="right arm"> <div class="right bicep"> <div class="right forearm"></div> </div> </div> </div> </div> </div> By the way, some remarks: // for a comment is an error in CSS. Don't do this. It happens to have no effect in your fiddle, but just look at this fiddle where it goes wrong. You don't need the vendor prefixes during testing. Remove them and the code works in all browsers. If you want to be backwards compatible with older ones, fine, you can add in the prefixed properties (above the unprefixed ones), but do that after you're done twiddling with them.
Cannot Move CSS Loader Container
I have a problem regarding the positioning of my container. Keeping the styles whilst removing the position: absolute; on the .dot seems to be proving rather tricky and with each attempt the dots are going all over the place! To clarify, I'm looking at being able to move the entire loader .sampleContainer { float: left; height: 40px; width: 60px; background: white; } .loader { display: inline-block; float: left; margin-left:100px; } .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #888; position: absolute; } .dot_1 { animation: animateDot1 1.5s linear infinite; left: 12px; /**background: #e579b8;**/ } .dot_2 { animation: animateDot2 1.5s linear infinite; animation-delay: 0.5s; left: 24px; } .dot_3 { animation: animateDot3 1.5s linear infinite; left: 12px; } .dot_4 { animation: animateDot4 1.5s linear infinite; animation-delay: 0.5s; left: 24px; } #keyframes animateDot1 { 0% { transform: rotate(0deg) translateX(-12px); } 25% { transform: rotate(180deg) translateX(-12px); } 75% { transform: rotate(180deg) translateX(-12px); } 100% { transform: rotate(360deg) translateX(-12px); } } #keyframes animateDot2 { 0% { transform: rotate(0deg) translateX(-12px); } 25% { transform: rotate(-180deg) translateX(-12px); } 75% { transform: rotate(-180deg) translateX(-12px); } 100% { transform: rotate(-360deg) translateX(-12px); } } #keyframes animateDot3 { 0% { transform: rotate(0deg) translateX(12px); } 25% { transform: rotate(180deg) translateX(12px); } 75% { transform: rotate(180deg) translateX(12px); } 100% { transform: rotate(360deg) translateX(12px); } } #keyframes animateDot4 { 0% { transform: rotate(0deg) translateX(12px); } 25% { transform: rotate(-180deg) translateX(12px); } 75% { transform: rotate(-180deg) translateX(12px); } 100% { transform: rotate(-360deg) translateX(12px); } } <div class="sampleContainer"> <div class="loader"> <span class="dot dot_1"></span> <span class="dot dot_2"></span> <span class="dot dot_3"></span> <span class="dot dot_4"></span> </div> </div>
you need to set position:relative to parent, otherwise it will be out of the DOM flow. As for my tests you don't need the .loader CSS .sampleContainer { float: left; height: 40px; width: 60px; background: white; position: relative; background: lightblue; } .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #888; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: 15px 8px } .dot_1 { animation: animateDot1 1.5s linear infinite; left: 12px; /**background: #e579b8;**/ } .dot_2 { animation: animateDot2 1.5s linear infinite; animation-delay: 0.5s; left: 24px; } .dot_3 { animation: animateDot3 1.5s linear infinite; left: 12px; } .dot_4 { animation: animateDot4 1.5s linear infinite; animation-delay: 0.5s; left: 24px; } #keyframes animateDot1 { 0% { transform: rotate(0deg) translateX(-12px); } 25% { transform: rotate(180deg) translateX(-12px); } 75% { transform: rotate(180deg) translateX(-12px); } 100% { transform: rotate(360deg) translateX(-12px); } } #keyframes animateDot2 { 0% { transform: rotate(0deg) translateX(-12px); } 25% { transform: rotate(-180deg) translateX(-12px); } 75% { transform: rotate(-180deg) translateX(-12px); } 100% { transform: rotate(-360deg) translateX(-12px); } } #keyframes animateDot3 { 0% { transform: rotate(0deg) translateX(12px); } 25% { transform: rotate(180deg) translateX(12px); } 75% { transform: rotate(180deg) translateX(12px); } 100% { transform: rotate(360deg) translateX(12px); } } #keyframes animateDot4 { 0% { transform: rotate(0deg) translateX(12px); } 25% { transform: rotate(-180deg) translateX(12px); } 75% { transform: rotate(-180deg) translateX(12px); } 100% { transform: rotate(-360deg) translateX(12px); } } <div style="float:left">Deleting 'Folder Name' folder</div> <div class="sampleContainer"> <div class="loader"> <span class="dot dot_1"></span> <span class="dot dot_2"></span> <span class="dot dot_3"></span> <span class="dot dot_4"></span> </div> </div>
Centering Scrolling Text
I have the following HTML: <div id="square" class="zoomInUp animated"> <p class="header-name">Theo Bearman</p> <p class="header-title">Interests in <span class="rw-words rw-words-1"> <span>Web Designer</span> <span>Web Developer</span> <span>Graphic Designer</span> </span></p></div> And the following CSS: /* Animated words ------------------------------------------------- */ .rw-words{ text-indent: 10px; font-size: 16px; font-weight: 100; text-align: center } .rw-words-1 span{ position: absolute; opacity: 0; overflow: hidden; -webkit-animation: rotateWord 9s linear infinite 0s; -ms-animation: rotateWord 9s linear infinite 0s; animation: rotateWord 9s linear infinite 0s; text-align: center } .rw-words-1 span:nth-child(2) { -webkit-animation-delay: 3s; -ms-animation-delay: 3s; animation-delay: 3s; } .rw-words-1 span:nth-child(3) { -webkit-animation-delay: 6s; -ms-animation-delay: 6s; animation-delay: 6s; } #-webkit-keyframes rotateWord { 0% { opacity: 0; } 2% { opacity: 0; -webkit-transform: translateY(-30px); } 5% { opacity: 1; -webkit-transform: translateY(0px);} 25% { opacity: 1; -webkit-transform: translateY(0px); } 40% { opacity: 0; -webkit-transform: translateY(30px); } 80% { opacity: 0; } 100% { opacity: 0; } } #-ms-keyframes rotateWord { 0% { opacity: 0; } 2% { opacity: 0; -ms-transform: translateY(-30px); } 5% { opacity: 1; -ms-transform: translateY(0px);} 25% { opacity: 1; -ms-transform: translateY(0px); } 40% { opacity: 0; -ms-transform: translateY(30px); } 80% { opacity: 0; } 100% { opacity: 0; } } #keyframes rotateWord { 0% { opacity: 0; } 2% { opacity: 0; -webkit-transform: translateY(-30px); transform: translateY(-30px); } 5% { opacity: 1; -webkit-transform: translateY(0px); transform: translateY(0px);} 25% { opacity: 1; -webkit-transform: translateY(0px); transform: translateY(0px); } 40% { opacity: 0; -webkit-transform: translateY(30px); transform: translateY(30px); } 80% { opacity: 0; } 100% { opacity: 0; } } #media screen and (max-width: 768px){ .rw-sentence { font-size: 18px; } } #media screen and (max-width: 320px){ .rw-sentence { font-size: 9px; } } .header-name2 { background-color: #000; padding: 5px 17px; display: inline-block; color: #fff; font-size: 13px; font-weight: 400; text-transform: uppercase; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; border-left: 3px solid #f00; border-right: 3px solid #0045ff; } .header-title { font-size: 16px; font-weight: 100; } What would I need to do to change my code so that header-title is centered underneath header-name2 with the scrolling words included? A live example is here. You can see that the text "Interests in" is centered but the scrolling words are not. Thanks in advance!
You can do this: .rw-words{ .... display: block; position: relative; } .rw-words-1 span{ left:25%; right: 25%; } and remove text-indent from .rw-words
You could give .header-title { margin-left: -110px; }
<div class="rw-words rw-words-1"> <div id = 'cont'></div> <div>Web Designer</div> <div>Web Developer</div> <div>Graphic Designer</div> </div> Put a blank container div in there #cont { position:relative; width: 10em; } Problem is absolute position is not taking up any "space" and therefore not computed in centering.