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 :
Related
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>
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>
I'm using a hover box in my application which shows a content on hover. However , I am not able to get the text in the middle when the box is NOT hovered.
This is my html:
<div class="container">
<div class="col-xs-3" style="padding-top: 20px;">
<div class="box box-type-double">
<div class="box-hover" href="#">
<div class="box-info">
<div class="date">
<p>Design Mixes</p>
</div>
<div class="line"></div>
<div class="headline">Mix Designs Grade of all concrete’s, DLC, PQC, BM, and DBM, BC.</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</div>
<div class="box-content">Design Mixes</div>
</div>
</div>
</div>
This is my Css:
.box {
text-align: center;
/*float: left;*/
/*margin: 5px;*/
position: relative;
}
.box,
.box-hover,
.box-hover .mask,
.box-img,
.box-info {
background-color: #b4a28f;
}
.box-hover,
.box-hover .mask,
.box-img {
position: absolute;
top: 0;
left: 0;
}
.box-type-double .box-hover {
z-index: 5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
cursor: pointer;
display: block;
text-decoration: none;
text-align: center;
}
.box-type-double .box-info {
z-index: 10;
color: #ffffff;
display: table-cell;
vertical-align: middle;
position: relative;
z-index: 5;
height: 200px;
}
.box-type-double .box-info .headline {
font-size: 15px;
width: 90%;
margin: 0 auto;
}
.box-type-double .box-info .line {
height: 2px;
width: 0%;
margin: 15px auto;
background-color: #ffffff;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box-type-double .box-info .date {
font-size: 10px;
}
.box-type-double .box-hover .mask {
background-color: #000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 0;
}
.box-type-double .box-hover:hover .line {
width: 90%;
}
.box-type-double .box-hover:hover {
opacity: 1;
}
.box-content {
font-size: 15px;
background-color: #3178b9;
color: white;
z-index: 0;
height: 200px;
}
Plunker link : https://plnkr.co/edit/2TiWlPG7cVIQ56zR5UGX
Put it in a span and apply flex to box-content
.box {
text-align: center;
/*float: left;*/
/*margin: 5px;*/
position: relative;
}
.box,
.box-hover,
.box-hover .mask,
.box-img,
.box-info {
background-color: #b4a28f;
}
.box-hover,
.box-hover .mask,
.box-img {
position: absolute;
top: 0;
left: 0;
}
.box-type-double .box-hover {
z-index: 5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
cursor: pointer;
display: block;
text-decoration: none;
text-align: center;
}
.box-type-double .box-info {
z-index: 10;
color: #ffffff;
display: table-cell;
vertical-align: middle;
position: relative;
z-index: 5;
height: 200px;
}
.box-type-double .box-info .headline {
font-size: 15px;
width: 90%;
margin: 0 auto;
}
.box-type-double .box-info .line {
height: 2px;
width: 0%;
margin: 15px auto;
background-color: #ffffff;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box-type-double .box-info .date {
font-size: 10px;
}
.box-type-double .box-hover .mask {
background-color: #000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 0;
}
.box-type-double .box-hover:hover .line {
width: 90%;
}
.box-type-double .box-hover:hover {
opacity: 1;
}
.box-content {
font-size: 15px;
background-color: #3178b9;
color: white;
z-index: 0;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
<div class="container">
<div class="col-xs-3" style="padding-top: 20px;">
<div class="box box-type-double">
<div class="box-hover" href="#">
<div class="box-info">
<div class="date">
<p>Design Mixes</p>
</div>
<div class="line"></div>
<div class="headline">Mix Designs Grade of all concrete’s, DLC, PQC, BM, and DBM, BC.</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</div>
<div class="box-content"><span>Design Mixes<span></div>
</div>
</div>
</div>
.box-hover {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.box-type-double .box-info {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
Let's check it out !
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>
Trying to make icons fade to .5 opacity and have link text fade in to 1.0 opacity at the same time. I can only get one to work. Trying to fix this without totally revamping the css and html if possible.
I'm trying to do this for the shop online store icons of this website:
http://mbc.milkstreetmarketing.com/.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.comingsoon:hover {
opacity: 1;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">Shop Online Store</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>
</div>
</div>
</div>
Have you tried something like this?
.icons:hover .shopnow, .icons:hover .comingsoon{
opacity: 1;
}
.icons:hover img{
opacity: .5;
}
Then you can remove these:
.shopnow:hover {
opacity: 1;
}
.comingsoon:hover {
opacity: 1;
}
I think you are looking for the + selector:
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
When you hover .imgicon or .comingsoon, opacity: 1 is applied to .commingsoon. And when you hover .imgicon, opacity: 0.5 is applied to it.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">
Shop Online Store
</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>