CSS carousel only shows last picture over and over - html

I am trying to implement this carousel in my project. When I put my HTML into the codepen, it works fine, but when I put the css in my project it will only show the 5th card on repeat. I think it is placing all the cards on top of each other and cycling them all at once with card 5 on top.
I have changed a little bit of the css for the card carousel, but nothing that should be breaking it. Is it my card styles that are causing the issue? Something else?
Thank you for any help you can provide!
HTML:
<div class="card-ctn">
<div class="card" >
<img src= "http://books.google.com/books/content?id=1Kw1elu9QjAC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Paint It Black</h5>
<p class="card-text">Janet Fitch</p>
<p class="desc">
"some text"
</p>
<div class="hide">075956812X</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=g0OZtYOW1v8C&printsec=frontcover&img=1&zoom=1&source=gbs_api " >
<div class="descriptions">
<h5 class="title"> A Storm of Swords Complete Edition (Two in One) (A Song of Ice and Fire, Book 3)</h5>
<p class="card-text">George R. R. Martin</p>
<p class="desc">
some text
</p>
<div class="hide">9780007426232</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=FKzLugEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api" >
<div class="descriptions">
<h5 class="title"> 1066</h5>
<p class="card-text">David Armine Howarth</p>
<p class="desc">
some text
</p>
<div class="hide">0140058508</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=zV4PuFn5gvoC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Sex at Dawn</h5>
<p class="card-text">Christopher Ryan,Cacilda Jetha</p>
<p class="desc">
Some Text
</p>
<div class="hide">075956812X</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=XfFvDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Atomic Habits</h5>
<p class="card-text">James Clear</p>
<p class="desc">
Some Text
</p>
<div class="hide">9780735211292</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
</div>
CSS (which I changed a little bit)
/* *************************
Card Carousel
**************************** */
#keyframes display {
0% {
transform: translateX(300px);
opacity: 0;
}
20% {
transform: translateX(0);
opacity: 1;
}
80% {
transform: translateX(0);
opacity: 1;
}
100% {
transform: translateX(-300px);
opacity: 0;
}
}
.card-ctn {
position: relative;
height: 400px;
margin-bottom: -30px;
overflow: hidden;
margin-top: -30px;
}
.card-ctn > .card {
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
text-align: center;
opacity: 0;
animation: display 8s infinite;
}
.card:nth-child(2) {
animation-delay: 2s;
}
.card:nth-child(3) {
animation-delay: 4s;
}
.card:nth-child(4) {
animation-delay: 6s;
}
.card:nth-child(5) {
animation-delay: 8s;
}
/* *************************
End Card Carousel
**************************** */
/* *************************
Card Styles
**************************** */
.card {
flex: 1;
flex-basis: 300px;
flex-grow: 0;
height: 300px;
width: 200px;
background: #fff;
border: 2px solid #fff;
box-shadow: 0px 4px 7px rgba(0, 0, 0, 0.5);
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
overflow: hidden;
position: relative;
margin-top: 38px;
margin-left: 20px;
}
.card img {
width: 100%;
height: 100%;
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
}
.descriptions {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
transition: all 0.7s ease-in-out;
padding: 20px;
box-sizing: border-box;
clip-path: circle(0% at 100% 100%);
}
.card:hover .descriptions {
left: 0px;
transition: all 0.7s ease-in-out;
clip-path: circle(75%);
}
.card:hover {
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.3);
transform: scale(0.97);
}
.card:hover img {
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
transform: scale(1.6) rotate(20deg);
filter: blur(3px);
}
.card h5 {
color: white;
text-shadow: 0 0 5px black;
letter-spacing: 1px;
margin: 0px;
margin-top: -20px;
height: 45px;
overflow: hidden;
}
.card p {
color: white;
text-shadow: 0 0 5px black;
line-height: 24px;
font-size: 15px;
}
.card-text {
height: 47px;
}
.card:hover .desc {
background: rgba(54, 54, 54, 0.356);
border-radius: 10px 0 0 10px;
}
.desc {
height: 100px;
height: 147px;
width: 100%;
overflow-y: scroll;
padding-right: 40px;
margin-bottom: 20px;
margin-top: -12px;
box-sizing: content-box;
mix-blend-mode: difference;
}
.card button {
position: absolute;
bottom: 15px;
width: 70px;
height: 30px;
cursor: pointer;
border-style: none;
background-color: #04a304;
color: #fff;
font-size: 13px;
outline: none;
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.4);
transition: all 0.5s ease-in-out;
}
.wish {
right: 10px;
}
.cart {
left: 10px;
}
.card button:hover {
transform: scale(0.95) translateX(-5px);
transition: all 0.5s ease-in-out;
}
.hide {
opacity: 0;
}

It works for me!
html, body {
margin: 0;
padding: 0;
}
.pic-ctn {
width: 100vw;
height: 200px;
}
#keyframes display {
0% {
transform: translateX(200px);
opacity: 0;
}
10% {
transform: translateX(0);
opacity: 1;
}
20% {
transform: translateX(0);
opacity: 1;
}
30% {
transform: translateX(-200px);
opacity: 0;
}
100% {
transform: translateX(-200px);
opacity: 0;
}
}
.pic-ctn {
position: relative;
width: 100vw;
height: 300px;
margin-top: 15vh;
}
.pic-ctn > .card {
position: absolute;
top: 0;
left: calc(50% - 100px);
opacity: 0;
animation: display 10s infinite;
}
.card:nth-child(2) {
animation-delay: 2s;
}
.card:nth-child(3) {
animation-delay: 4s;
}
.card:nth-child(4) {
animation-delay: 6s;
}
.card:nth-child(5) {
animation-delay: 8s;
}
.card {
flex: 1;
flex-basis: 300px;
flex-grow: 0;
height: 300px;
width: 200px;
background: #fff;
border: 2px solid #fff;
box-shadow: 0px 4px 7px rgba(0, 0, 0, 0.5);
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
overflow: hidden;
position: relative;
margin-top: 38px;
margin-left: 20px;
}
.card img {
width: 100%;
height: 100%;
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
}
.descriptions {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
transition: all 0.7s ease-in-out;
padding: 20px;
box-sizing: border-box;
clip-path: circle(0% at 100% 100%);
}
.card:hover .descriptions {
left: 0px;
transition: all 0.7s ease-in-out;
clip-path: circle(75%);
}
.card:hover {
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.3);
transform: scale(0.97);
}
.card:hover img {
transition: all 0.5s cubic-bezier(0.8, 0.5, 0.2, 1.4);
transform: scale(1.6) rotate(20deg);
filter: blur(3px);
}
.card h5 {
color: white;
text-shadow: 0 0 5px black;
letter-spacing: 1px;
margin: 0px;
margin-top: -20px;
height: 45px;
overflow: hidden;
}
.card p {
color: white;
text-shadow: 0 0 5px black;
line-height: 24px;
font-size: 15px;
}
.card-text {
height: 47px;
}
.card:hover .desc {
background: rgba(54, 54, 54, 0.356);
border-radius: 10px 0 0 10px;
}
.desc {
height: 100px;
height: 147px;
width: 100%;
overflow-y: scroll;
padding-right: 40px;
margin-bottom: 20px;
margin-top: -12px;
box-sizing: content-box;
mix-blend-mode: difference;
}
.card button {
position: absolute;
bottom: 15px;
width: 70px;
height: 30px;
cursor: pointer;
border-style: none;
background-color: #04a304;
color: #fff;
font-size: 13px;
outline: none;
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.4);
transition: all 0.5s ease-in-out;
}
.wish {
right: 10px;
}
.cart {
left: 10px;
}
.card button:hover {
transform: scale(0.95) translateX(-5px);
transition: all 0.5s ease-in-out;
}
.hide {
opacity: 0;
}
<div class="pic-ctn">
<div class="card" >
<img src= "http://books.google.com/books/content?id=1Kw1elu9QjAC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Paint It Black</h5>
<p class="card-text">Janet Fitch</p>
<p class="desc">
"some text"
</p>
<div class="hide">075956812X</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=g0OZtYOW1v8C&printsec=frontcover&img=1&zoom=1&source=gbs_api " >
<div class="descriptions">
<h5 class="title"> A Storm of Swords Complete Edition (Two in One) (A Song of Ice and Fire, Book 3)</h5>
<p class="card-text">George R. R. Martin</p>
<p class="desc">
some text
</p>
<div class="hide">9780007426232</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=FKzLugEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api" >
<div class="descriptions">
<h5 class="title"> 1066</h5>
<p class="card-text">David Armine Howarth</p>
<p class="desc">
some text
</p>
<div class="hide">0140058508</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=zV4PuFn5gvoC&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Sex at Dawn</h5>
<p class="card-text">Christopher Ryan,Cacilda Jetha</p>
<p class="desc">
Some Text
</p>
<div class="hide">075956812X</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
<div class="card" >
<img src= "http://books.google.com/books/content?id=XfFvDwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" >
<div class="descriptions">
<h5 class="title">Atomic Habits</h5>
<p class="card-text">James Clear</p>
<p class="desc">
Some Text
</p>
<div class="hide">9780735211292</div>
<button (click)="addToCart($event)" class="btn cart">Cart</button>
<button (click)="addToWishlist($event)" class="btn wish">Wishlist</button>
</div>
</div>
</div>

Related

Bootstrap 4 cards coming out of container div and overlapping next element

I'm trying to build a responsive template with bootstrap 4 where there are three cards involved inside a container div. When changing the aspect ratio in mobile view, the cards are coming out of the container div and overlapping to the footer element outside it's container. Check my code below:
HTML:
<div class="container-fluid parallax">
<div class="d-flex justify-content-center">
<h1 class="title"><strong>Our Services</strong></h1>
</div>
<div class="parallax-row row justify-content-center">
<div class="parallax-cell col-sm-3">
<div class="hovereffect">
<img class="img-responsive" src="assets/images/web_dev_service.jpg" alt="" width="350" height="200">
<div class="overlay">
<h2>header</h2>
<a class="info" href="#">Know More</a>
</div>
</div>
</div>
<div class="parallax-cell col-sm-3">
<div class="hovereffect">
<img class="img-responsive" src="assets/images/digital_marketing_service.jpg" alt="" width="350" height="200">
<div class="overlay">
<h2>header</h2>
<a class="info" href="#">Know More</a>
</div>
</div>
</div>
<div class="parallax-cell col-sm-3">
<div class="hovereffect">
<img class="img-responsive" src="assets/images/creative_logo_service.jpg" alt="" width="350" height="200">
<div class="overlay">
<h2>header</h2>
<a class="info" href="#">Know More</a>
</div>
</div>
</div>
</div>
</div>
CSS:
.parallax {
background-image: url("/assets/images/home_services.jpg");
min-height: 700px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-color: #ff0;
position: relative;
}
.parallax-row {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
}
.parallax-cell {
align-self: center;
}
.hovereffect {
width: 100%;
height: 100%;
float: left;
overflow: hidden;
position: relative;
text-align: center;
cursor: default;
border-radius: 5%;
}
.hovereffect .overlay {
width: 100%;
height: 100%;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
opacity: 0;
background-color: rgba(0, 0, 0, 0.5);
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out
}
.hovereffect img {
display: block;
position: relative;
-webkit-transition: all .4s linear;
transition: all .4s linear;
background-color: #f00;
}
.hovereffect h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
background: rgba(0, 0, 0, 0.6);
-webkit-transform: translatey(-100px);
-ms-transform: translatey(-100px);
transform: translatey(-100px);
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
padding: 10px;
}
.hovereffect a.info {
text-decoration: none;
display: inline-block;
text-transform: uppercase;
color: #fff;
border: 1px solid #fff;
background-color: transparent;
opacity: 0;
filter: alpha(opacity=0);
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
margin: 50px 0 0;
padding: 7px 14px;
}
.hovereffect a.info:hover {
box-shadow: 0 0 5px #fff;
}
.hovereffect:hover img {
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
.hovereffect:hover .overlay {
opacity: 1;
filter: alpha(opacity=100);
}
.hovereffect:hover h2,
.hovereffect:hover a.info {
opacity: 1;
filter: alpha(opacity=100);
-ms-transform: translatey(0);
-webkit-transform: translatey(0);
transform: translatey(0);
}
.hovereffect:hover a.info {
-webkit-transition-delay: .2s;
transition-delay: .2s;
}
Just do two things.
Replace .parallax-row with below.
.parallax-row {
display: flex;
justify-content: center;
align-items: center;
}
Replace .parallax-cell with below.
.parallax-cell {
align-self: center;
margin-bottom: 20px;
}
Here is running JSFiddle - https://jsfiddle.net/t4qfvmkr/
just need to change the property min-height to height: 100% in parallax class

The animation does not work when I hover around the border

When I hover over the border, the animation does not render
The original code pen link is as shown below
https://codepen.io/anon/pen/GVvxqq
i need the product class css to remain
how do i add in the animation without affecting the product class?
//HTML
<template>
<div class="item button draw">
<b-link #click="productDetail(item.productId)">
<div class="product">
<a class="img-prod">
<img
class="img-fluid product-image"
:src="item.options[0].productImages[0].imageUrl"
alt="Product Item"
/>
<span v-if="item.discounts.length != 0" class="status">{{discountPercentageTag}}% OFF</span>
</a>
<div class="text pt-3 px-3">
<h3>{{item.productName}}</h3>
<div class="d-flex">
<div class="pricing">
<p v-if="item.discounts.length != 0" class="price">
<span class="mr-2 price-dc">${{item.price.toFixed(2)}}</span>
<span class="price-sale">${{discountPrice.toFixed(2)}}</span>
</p>
<p v-else class="price">
<span>${{item.price.toFixed(2)}}</span>
</p>
</div>
</div>
</div>
</div>
</b-link>
</div>
</template>
//CSS
i need the product class css to remain
.product{
display: block;
width: 100%;
margin-bottom: 30px;
#include media-breakpoint-down(md){
margin-bottom: 30px;
}
.button {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
}
.button::before, .button::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
.draw {
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.draw::before {
top: 0;
left: 0;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover::before, .draw:hover::after {
width: 100%;
height: 100%;
}
.draw:hover::before {
border-top-color: #60daaa;
border-right-color: #60daaa;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
border-bottom-color: #60daaa;
border-left-color: #60daaa;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
.img-prod{
position: relative;
display: block;
overflow: hidden;
span.status{
position: absolute;
top: 10px;
left: -1px;
padding: 2px 15px;
color: $black;
font-weight: 300;
background: $primary;
}
img{
-webkit-transform: scale(1.0);
-moz-transform: scale(1.0);
-ms-transform: scale(1.0);
-o-transform: scale(1.0);
transform: scale(1.0);
#include transition(.3s);
}
&:hover, &:focus{
img{
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
}
}
Only the border colour is rendered but not the animation
I have fixed it. something wrong with template tag i have removed it and worked.
.button {
background: none;
border: 0;
box-sizing: border-box;
margin: 1em;
padding: 1em 2em;
box-shadow: inset 0 0 0 2px #f45e61;
color: #f45e61;
font-size: inherit;
font-weight: 700;
position: relative;
vertical-align: middle;
}
img{width:100%}
.button::before, .button::after {
box-sizing: inherit;
content: '';
position: absolute;
width: 100%;
height: 100%;
}
.draw {
transition: color 0.25s;
}
.draw::before, .draw::after {
border: 2px solid transparent;
width: 0;
height: 0;
}
.draw::before {
top: 0;
left: 0;
}
.draw::after {
bottom: 0;
right: 0;
}
.draw:hover::before, .draw:hover::after {
width: 100%;
height: 100%;
}
.draw:hover::before {
border-top-color: #60daaa;
border-right-color: #60daaa;
transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.draw:hover::after {
border-bottom-color: #60daaa;
border-left-color: #60daaa;
transition: border-color 0s ease-out 0.5s, width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
<div class="item button draw">
<b-link #click="productDetail(item.productId)">
<div class="product">
<a class="img-prod">
<img
class="img-fluid product-image"
:src="https://colorlib.com/wp/wp-content/uploads/sites/2/store-free-template.jpg"
alt="Product Item"
/>
<spanclass="status">test OFF</span>
</a>
<div class="text pt-3 px-3">
<h3>test</h3>
<div class="d-flex">
<div class="pricing">
<p v-if="item.discounts.length != 0" class="price">
<span class="mr-2 price-dc">$5423</span>
<span class="price-sale">$5345</span>
</p>
<p v-else class="price">
<span>$435345</span>
</p>
</div>
</div>
</div>
</div>
</b-link>
</div>
You need to wrap the entire block in <section class="buttons"> and change the outermost <div> to <button> if you want to use the CSS as-is from the codepen. I have tested this and it works as expected.
<template>
<section class="buttons">
<button class="item button draw">
<b-link #click="productDetail(item.productId)">
//
// custom element content
//
</b-link>
</button>
</section>
</template>

Can't get my css selector to work properly

the last :checked call in my css code is not working. I want to be ably to have the .nav-bar-element's move from off the screen to where they are now when the hamburger icon is clicked, but I can't seem to get the selector working.
#import url('https://fonts.googleapis.com/css?family=Raleway');
body {
background-image: url(http://www.hayesandjarvis.co.uk/medias/sys_master/hcf/hbb/8912480731166.jpg);
min-height: 100%;
position: relative;
opacity: 0.75;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
margin: 0;
font: 400 15px/1.8"Raleway", sans-serif;
color: #777;
}
.nav-bar {
z-index: 100;
background-color: rgba(255, 255, 255, 0.2);
width: 100vw;
height: 64px;
overflow: hidden;
position: absolute;
font-weight: bold;
font-size: 18px;
}
.nav-bar:hover {
background-color: rgba(255, 255, 255, 0.6);
-webkit-transition: 0.4s ease, width 0.3s ease;
transition: 0.4s ease, width 0.3s ease;
}
.nav-content {
position: absolute;
right: 0px;
float: right;
height: 64px;
width: 512px;
color: #000;
}
.nav-content .nav-bar-element {
float: left;
margin: 0px;
width: 100px;
height: 32px;
margin: 16px 25px 16px 25px;
}
.nav-content .nav-bar-element a {
width: 100px;
height: 32px;
text-decoration: none;
color: #000;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#nav-button {
display: none;
}
.menu-button {
z-index: 101;
vertical-align: baseline;
position: absolute;
height: 48px;
width: 48px;
top: 8px;
right: 25px;
}
.bar {
position: absolute;
height: 2px;
width: 66%;
background-color: #000;
left: 20%;
-webkit-transition: 0.4s ease, width 0.3s ease;
transition: 0.4s ease, width 0.3s ease;
}
.bar:nth-child(1) {
top: 24%;
}
.bar:nth-child(2) {
top: 47%;
}
.bar:nth-child(3) {
top: 47%;
}
.bar:nth-child(4) {
top: 71%;
}
#nav-button:checked+ .menu-button .bar:nth-child(1) {
width: 0px;
}
#nav-button:checked+ .menu-button .bar:nth-child(2) {
-webkit-transform: translateX(-50%) rotate(45deg);
transform: rotate(45deg);
}
#nav-button:checked+ .menu-button .bar:nth-child(3) {
-webkit-transform: translateX(-50%) rotate(-45deg);
transform: rotate(-45deg);
}
#nav-button:checked+ .menu-button .bar:nth-child(4) {
width: 0px;
}
#nav-button:checked+ #change-me {
color: #fff;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="bgimg-1">
<!--<div class="nav-bar-bg"></div>-->
<div class="nav-bar">
<input type="checkbox" id="nav-button" />
<label for="nav-button" class="menu-button">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</label>
<div class="nav-content" id="change-me">
<div class="nav-bar-element"><i class="fa fa-rocket" aria-hidden="true"></i> Projects
</div>
<div class="nav-bar-element"><i class="fa fa-user" aria-hidden="true"></i> About Me
</div>
<div class="nav-bar-element"><i class="fa fa-inbox" aria-hidden="true"></i> Contact
</div>
</div>
</div>
</div>
I need glasses it is a sibling, but not the adjacent sibling, so use ~ instead of +
OR
Use + between checkbox and label and a + between label and #change-me,
Remove the + on last ruleset, because #change-me is a child of #nav-button, not na sibling.
OK I finally got enough specificity! Use this:
#nav-button:checked ~ .nav-content#change-me * {
color: #fff;
}
SNIPPET
#import url('https://fonts.googleapis.com/css?family=Raleway');
body {
background-image: url(http://www.hayesandjarvis.co.uk/medias/sys_master/hcf/hbb/8912480731166.jpg);
min-height: 100%;
position: relative;
opacity: 0.75;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
margin: 0;
font: 400 15px/1.8"Raleway", sans-serif;
color: #777;
}
.nav-bar {
z-index: 100;
background-color: rgba(255, 255, 255, 0.2);
width: 100vw;
height: 64px;
overflow: hidden;
position: absolute;
font-weight: bold;
font-size: 18px;
}
.nav-bar:hover {
background-color: rgba(255, 255, 255, 0.6);
-webkit-transition: 0.4s ease, width 0.3s ease;
transition: 0.4s ease, width 0.3s ease;
}
.nav-content {
position: absolute;
right: 0px;
float: right;
height: 64px;
width: 512px;
color: #000;
}
.nav-content .nav-bar-element {
float: left;
margin: 0px;
width: 100px;
height: 32px;
margin: 16px 25px 16px 25px;
}
.nav-content .nav-bar-element a {
width: 100px;
height: 32px;
text-decoration: none;
color: #000;
-webkit-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#nav-button {
display: none;
}
.menu-button {
z-index: 101;
vertical-align: baseline;
position: absolute;
height: 48px;
width: 48px;
top: 8px;
right: 25px;
}
.bar {
position: absolute;
height: 2px;
width: 66%;
background-color: #000;
left: 20%;
-webkit-transition: 0.4s ease, width 0.3s ease;
transition: 0.4s ease, width 0.3s ease;
}
.bar:nth-child(1) {
top: 24%;
}
.bar:nth-child(2) {
top: 47%;
}
.bar:nth-child(3) {
top: 47%;
}
.bar:nth-child(4) {
top: 71%;
}
#nav-button:checked+ .menu-button .bar:nth-child(1) {
width: 0px;
}
#nav-button:checked+ .menu-button .bar:nth-child(2) {
-webkit-transform: translateX(-50%) rotate(45deg);
transform: rotate(45deg);
}
#nav-button:checked+ .menu-button .bar:nth-child(3) {
-webkit-transform: translateX(-50%) rotate(-45deg);
transform: rotate(-45deg);
}
#nav-button:checked+ .menu-button .bar:nth-child(4) {
width: 0px;
}
#nav-button:checked ~ .nav-content#change-me * {
color: #fff;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sam Erickson</title>
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="bgimg-1">
<!--<div class="nav-bar-bg"></div>-->
<div class="nav-bar">
<input type="checkbox" id="nav-button" />
<label for="nav-button" class="menu-button">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</label>
<div class="nav-content" id="change-me">
<div class="nav-bar-element"><i class="fa fa-rocket" aria-hidden="true"></i> Projects
</div>
<div class="nav-bar-element"><i class="fa fa-user" aria-hidden="true"></i> About Me
</div>
<div class="nav-bar-element"><i class="fa fa-inbox" aria-hidden="true"></i> Contact
</div>
</div>
</div>
</body>
</html>

Linked container's hover shows blue during transition

I have three containers that act as links. For some reason whenever you hover over them the blocks turn blue for a second and then go to their hover color (dark gray). The only thing I could think of why it is doing it is because it is a link. I want the whole box to be a link and that is the reason I wrapped the boxes with the link.
Is there an alternative method to doing this and what is causing the blue background when hovered?
#info {
max-width: 80%;
height: auto;
}
#info-container {
padding: 10px 10% 200px 10%;
margin: 50px 10%;
}
.box {
width: 20%;
height: 300px;
opacity:1;
position: absolute;
line-height: 1.5em;
}
#green, #yellow, #red {
box-shadow: inset 0 0 0 0;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
transition: all ease 0.3s;
}
#green {
background: #3e745b;
left: 15%;
}
#yellow {
background: #6f9697;/*#f3db6d*/
left: 40%;
}
#red {
background: #3e745b;
left: 65%;
}
#green:hover, #yellow:hover, #red:hover {
/*box-shadow: inset 0 300px 0 0 #6f9697;*/
box-shadow: inset 0 300px 0 0 #303030;
}
#green.green{animation:slideinGreen .5s ease}
#yellow.yellow{animation:slideinYellow 1.3s ease}
#red.red{animation:slideinRed 2s ease}
#green.active,#red.active,#yellow.active{opacity: 1}
#keyframes slideinGreen {
from {
left: calc(25% - 250px);opacity:1;
}
}
#keyframes slideinYellow{
from {
left: calc(45% - 350px);opacity:1;
}
}
#keyframes slideinRed {
from {
left: calc(65% - 450px);opacity:1;
}
}
.info-box-title, .info-box-description {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
width: 90%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #FFF;
line-height: 1.4em;
}
.info-box-title {
font-size: 2em;
}
.box:hover .info-box-title {
display: none;
}
.info-box-description {
display: none;
font-size: 1.5em;
width: 75%;
line-height: 1.5em;
}
.box:hover .info-box-description {
display: block;
}
<section id="info">
<article id="info-container">
<a href="projects"><div id="green" class="box">
<div class="info-box-title">PROJECT AFTER PROJECT</div>
<div class="info-box-description">Over 60 years of accumulated projects.</div>
</div></a>
<a href="about"><div id="yellow" class="box">
<div class="info-box-title">YEARS OF DEMOLITION HISTORY</div>
<div class="info-box-description">Find out about - The Eslich Wrecking Company.</div>
</div></a>
<a href="contact"><div id="red" class="box">
<div class="info-box-title">GET IN TOUCH WITH US</div>
<div class="info-box-description">Contact us for more information.</div>
</div></a>
</article>
</section>
Reason:
Currently, you are not specifying the color for the box-shadow in the un-hovered state.
#green, #yellow, #red {
box-shadow: inset 0 0 0 0; /* there is no color specified */
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
transition: all ease 0.3s;
}
If it is not specified, most browsers use the current color. Below is the extract from MDN: (emphasis mine)
<color>
See <color> values for possible keywords and notations.
If not specified, the color used depends on the browser - it is usually the value of the color property, but note that Safari currently paints a transparent shadow in this case.
The above means that in the default state, the color of the shadow is the element's default color and on hover it transitions from that default color to the color that you've specified (because all properties are being transitioned) and hence you see the blue color.
For a tags, the default color in most browsers is blue (it is color: rgb(0, 0, 238); in Chrome). The div which has the box-shadow has no explicit color specified and so it would inherit parent's color.
Solution: Set the expected color to the box-shadow in its un-hovered state also.
#info {
max-width: 80%;
height: auto;
}
#info-container {
padding: 10px 10% 200px 10%;
margin: 50px 10%;
}
.box {
width: 20%;
height: 300px;
opacity: 1;
position: absolute;
line-height: 1.5em;
}
#green,
#yellow,
#red {
box-shadow: inset 0 0 0 0 #303030;
-webkit-transition: all ease 0.3s;
-moz-transition: all ease 0.3s;
transition: all ease 0.3s;
}
#green {
background: #3e745b;
left: 15%;
}
#yellow {
background: #6f9697;
/*#f3db6d*/
left: 40%;
}
#red {
background: #3e745b;
left: 65%;
}
#green:hover,
#yellow:hover,
#red:hover {
/*box-shadow: inset 0 300px 0 0 #6f9697;*/
box-shadow: inset 0 300px 0 0 #303030;
}
#green.green {
animation: slideinGreen .5s ease
}
#yellow.yellow {
animation: slideinYellow 1.3s ease
}
#red.red {
animation: slideinRed 2s ease
}
#green.active,
#red.active,
#yellow.active {
opacity: 1
}
#keyframes slideinGreen {
from {
left: calc(25% - 250px);
opacity: 1;
}
}
#keyframes slideinYellow {
from {
left: calc(45% - 350px);
opacity: 1;
}
}
#keyframes slideinRed {
from {
left: calc(65% - 450px);
opacity: 1;
}
}
.info-box-title,
.info-box-description {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
width: 90%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #FFF;
line-height: 1.4em;
}
.info-box-title {
font-size: 2em;
}
.box:hover .info-box-title {
display: none;
}
.info-box-description {
display: none;
font-size: 1.5em;
width: 75%;
line-height: 1.5em;
}
.box:hover .info-box-description {
display: block;
}
<section id="info">
<article id="info-container">
<a href="projects">
<div id="green" class="box">
<div class="info-box-title">PROJECT AFTER PROJECT</div>
<div class="info-box-description">Over 60 years of accumulated projects.</div>
</div>
</a>
<a href="about">
<div id="yellow" class="box">
<div class="info-box-title">YEARS OF DEMOLITION HISTORY</div>
<div class="info-box-description">Find out about - The Eslich Wrecking Company.</div>
</div>
</a>
<a href="contact">
<div id="red" class="box">
<div class="info-box-title">GET IN TOUCH WITH US</div>
<div class="info-box-description">Contact us for more information.</div>
</div>
</a>
</article>
</section>

ipad website issue -content outside shapes

1When I check on my website using my Ipad 2, the text and number in those bubbles bellow reaches outside the circle shape! it runs ok in my macbook. but now looking at the snippet i just found out it is out of place!!! any hints to fix it for any kind of screen and device? --> http://www.nausea.ws
.statsWrap {
width: 130px;
margin-left: 20px;
margin-right: 20px;
float: left;
}
.stats {
display: inline-block;
position: relative;
width: 100%;
transition: all 0.3s ease-in-out 0s;
}
.statDummy {
margin-top: 100%;
}
.statInfo {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #7b133c;
border-radius: 50%;
text-align: center;
}
.statNumber {
font-size: 30px;
transition: all 0.5s ease-in-out 0s;
padding-top: 45px;
margin-bottom: 0;
}
.statNumberMedium {
font-size: 30px;
transition: all 0.5s ease-in-out 0s;
padding-top: 45px;
margin-bottom: 0;
}
.statNumberSmall {
font-size: 30px;
transition: all 0.5s ease-in-out 0s;
padding-top: 45px;
margin-bottom: 0;
}
.statNumberTCC {
font-size: 30px;
transition: all 0.5s ease-in-out 0s;
padding-top: 45px;
margin-bottom: 0;
}
.statText1 {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
width: 160px;
margin-top: -25px;
margin-left: -14px;
}
.statText2 {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
margin-top: -45px;
width: 160px;
text-align: center;
margin-left: -14px;
line-height: 24px;
}
.statText3 {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
width: 160px;
margin-top: -35px;
margin-left: -14px;
}
.statText4 {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
width: 160px;
line-height: 24px;
margin-top: -52px;
margin-left: -14px;
}
.statText5 {
transition: all 0.5s ease-in-out 0s;
opacity: 0;
transform: scale(0);
padding: 0;
width: 160px;
line-height: 24px;
margin-top: -70px;
margin-left: -14px;
}
.stats:hover {
transform: scale(2);
z-index: 10;
}
.stats:hover .statNumber {
transform: scale(.6);
transform: translateY(-35px);
}
.stats:hover .statNumberTCC {
transform: scale(.6);
transform: translateY(-45px);
}
.stats:hover .statText1 {
transform: scale(.6);
opacity: 1;
}
.stats:hover .statText2 {
transform: scale(.6);
opacity: 1;
}
.stats:hover .statText3 {
transform: scale(.6);
opacity: 1;
}
.stats:hover .statText4 {
transform: scale(.6);
opacity: 1;
}
.stats:hover .statText5 {
transform: scale(.6);
opacity: 1;
}
<div class="sixteen columns">
<h3 class="sectionTitle">Reconhecimento Acadêmico</h3>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber">2011.2</p>
<p class="statText1">Prêmio Criatividade</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber">2012.1</p>
<p class="statText1">2ºlugar categoria campanha</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber">2012.2</p>
<p class="statText2">1ºlugar categoria campanha<br>Prêmio Criatividade<br>1ºlugar categoria geral</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber statNumberMedium">2013.1</p>
<p class="statText1">Prêmio Criatividade</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber">2013.2</p>
<p class="statText3">1ºlugar categoria audiovisual<br>1ºlugar voto popular</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber statNumberSmall">2014.1</p>
<p class="statText4">1ºlugar categoria audiovisual<br>2ºlugar categoria campanha<br>1ºlugar categoria voto popular<br>Gran Prix</p>
</div>
</div>
</div>
<div class="statsWrap">
<div class="stats">
<div class="statDummy"></div>
<div class="statInfo">
<p class="statNumber statNumberTCC">TCC</p>
<p class="statText5">Nota máxima pela monografia<br>“Faça-me um HIT: uma análise da integração entre marketing e indústria musical no século XXI”</p>
</div>
</div>
</div>
try this to avoid that the text go out the circle and tell me if this works please :
.statInfo {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: #7b133c;
border-radius: 50%;
text-align: center;
overflow: hidden;
}
and this too :
#media only screen and (max-width: 959px) {
.statNumberMedium, .statNumber {
font-size: 24px;
padding-top: 38px;
}
}
this is will certainly fix the problem , if it doesn't then try this :
#media only screen and (max-width: 959px) {
.statNumberMedium, .statNumber {
font-size: 24px !important;
padding-top: 38px !important;
}
}
gif to prove that it works for me :