Slide a link to top on image hover - html

I want to slide the plus icon link when the user hovers on the image. when the image isn't hovered I have placed the button outside of image and set the opacity: 0. then on hover I want it to slide in. so I'm setting the opacity: 1 and changing its positions. but on hover the link don't show up.
Any suggestions?
.project {
position: relative;
}
.project .image {
position: relative;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.project .image::before {
content: '';
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 1;
background: rgba(100, 81, 246, 0.9);
border-radius: 10px;
-webkit-transition: all 0.7s ease-out;
transition: all 0.7s ease-out;
}
.project .image img {
border-radius: 10px;
-webkit-box-shadow: 0px 0px 51px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0px 0px 51px 0px rgba(0, 0, 0, 0.15);
width: 100%;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.project .image img:hover {
-webkit-box-shadow: 0px 0px 65px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 0px 65px 0px rgba(0, 0, 0, 0.2);
}
.project .project:hover,
.project .image:hover::before {
opacity: 1;
}
.project .project:hover .view-link,
.project .image:hover .view-link {
opacity: 1;
top: 40%;
}
.project .view-link {
position: absolute;
top: 90%;
left: 0;
right: 0;
width: 50px;
height: 50px;
margin: 0 auto;
opacity: 0;
color: #fffefe;
z-index: 1;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.project .view-link:hover {
color: #cacaca;
}
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.15.0/css/all.css"
integrity="sha384-OLYO0LymqQ+uHXELyx93kblK5YIS3B2ZfLGBmsJaUyor7CpMTBsahDHByqSuWW+q"
crossorigin="anonymous"
/>
<div class="project">
<div class="image">
<img src="https://dummyimage.com/590x390/000/fff&text=Some+Image" alt="" />
</div>
<a class="view-link" href="#">
<i class="fas fa-plus-circle fa-3x"></i>
</a>
<h3>Lorem ipsum dolor sit amet.</h3>
</div>

The problem is this line:
.project .project:hover .view-link
You're referencing .project twice but there is only one mention of it in your HTML.
It should be:
.project:hover .view-link
Also, there was some missing HTML in your example code of which your CSS depended. I added two divs for #home-d and .projects-wrapper, respectively.
Demo
.project {
position: relative;
}
.project .image {
position: relative;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.project .image::before {
content: '';
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 1;
background: rgba(100, 81, 246, 0.9);
border-radius: 10px;
-webkit-transition: all 0.7s ease-out;
transition: all 0.7s ease-out;
}
.project .image img {
border-radius: 10px;
-webkit-box-shadow: 0px 0px 51px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0px 0px 51px 0px rgba(0, 0, 0, 0.15);
width: 100%;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.project .image img:hover {
-webkit-box-shadow: 0px 0px 65px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 0px 65px 0px rgba(0, 0, 0, 0.2);
}
.project .project:hover,
.project .image:hover::before {
opacity: 1;
}
.project:hover .view-link,
.project .image:hover .view-link {
opacity: 1;
top: 40%;
}
.project .view-link {
position: absolute;
top: 90%;
left: 0;
right: 0;
width: 50px;
height: 50px;
margin: 0 auto;
opacity: 0;
color: #fffefe;
z-index: 1;
-webkit-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
.project .view-link:hover {
color: #cacaca;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.0/css/all.css" integrity="sha384-OLYO0LymqQ+uHXELyx93kblK5YIS3B2ZfLGBmsJaUyor7CpMTBsahDHByqSuWW+q" crossorigin="anonymous" />
<div class="project">
<div class="image">
<img src="https://dummyimage.com/590x390/000/fff&text=Some+Image" alt="" />
</div>
<a class="view-link" href="#">
<i class="fas fa-plus-circle fa-3x"></i>
</a>
<h3>Lorem ipsum dolor sit amet.</h3>
</div>

Related

Zoom whole content inside the div box

I want the whole content inside the div to zoom, but only div is zooming and content remaining same size. Something need to change in the CSS which I got from a free template and don't to know what to change. Any suggestions please?
.product-item {
width: 20%;
height: 380px;
cursor: pointer;
}
.product-item::after {
display: block;
position: absolute;
top: 0;
left: -1px;
width: calc(100% + 1px);
height: 100%;
pointer-events: none;
content: '';
border: solid 2px rgba(235, 235, 235, 0);
border-radius: 3px;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.product-item:hover::after {
box-shadow: 0 25px 29px rgba(63, 78, 100, 0.15);
border: solid 2px rgba(235, 235, 235, 1);
transform: scale(1.2);
}
<div class="product-item">
<div class="product_image">
<img src="assets/images/product_3.png" alt="">
</div>
<div class="favorite"></div>
<div class="product_info">
<h6 class="product_name">Mexican Pizza (Extra Toppings)</h6>
<div class="product_price">$820.00</div>
</div>
<div class="add_to_cart_button">add to cart</div>
</div>
Remove ::after And you are good to go. You don't need to hover over the pseudo element.
.product-item:hover {
box-shadow: 0 25px 29px rgba(63, 78, 100, 0.15);
border: solid 2px rgba(235, 235, 235, 1);
transform: scale(1.2);
}
.product-item {
width: 20%;
height: 380px;
cursor: pointer;
}
.product-item::after {
display: block;
position: absolute;
top: 0;
left: -1px;
width: calc(100% + 1px);
height: 100%;
pointer-events: none;
content: '';
border: solid 2px rgba(235, 235, 235, 0);
border-radius: 3px;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.product-item:hover {
box-shadow: 0 25px 29px rgba(63, 78, 100, 0.15);
border: solid 2px rgba(235, 235, 235, 1);
transform: scale(1.2);
}
<div class="product-item">
<div class="product_image">
<img src="assets/images/product_3.png" alt="">
</div>
<div class="favorite"></div>
<div class="product_info">
<h6 class="product_name">Mexican Pizza (Extra Toppings)</h6>
<div class="product_price">$820.00</div>
</div>
<div class="add_to_cart_button">add to cart</div>
</div>

Logo image isn't showing up on mobile site but shows up on desktop site

I am using the Minimaxing template to build my website. I changed it so that the logo in the Nav bar so it's a picture of my logo. It shows up nicely on desktop, but it does not show up on mobile. If it was simply text rather than an image, it shows up perfectly fine as displayed in the Minimaxing template website.
All of my code is essentially the same as that in the original but I added the below code to "index.html"
<!-- Header -->
<div id="header-wrapper">
<div class="container">
<div class="row">
<div class="col-12">
<header id="header">
<img class="logo" id="logo" src="C:\Users\test\Desktop\html5up-minimaxing\images\logo.png" width="250">
<nav id="nav">
Homepage
Test1
Test2
Test3
Test4
</nav>
</header>
</div>
</div>
</div>
</div>
And the below code to "main.css"
.logo {
display: flex;
vertical-align: top;
height: 30px;
visibility: visible;
margin-right: 20px;
margin-top: 28px;
}
The actual template has a lot more code that I can't fit on this page, but I will add the code that I think pertains to the mobile nav bar.
/* Nav */
#page-wrapper {
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-moz-transition: -moz-transform 0.5s ease;
-webkit-transition: -webkit-transform 0.5s ease;
-ms-transition: -ms-transform 0.5s ease;
transition: transform 0.5s ease;
padding-bottom: 1px;
}
#titleBar {
background-image: -moz-linear-gradient(top, #008dab, #007294);
background-image: -webkit-linear-gradient(top, #008dab, #007294);
background-image: -ms-linear-gradient(top, #008dab, #007294);
background-image: linear-gradient(top, #008dab, #007294);
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-moz-transition: -moz-transform 0.5s ease;
-webkit-transition: -webkit-transform 0.5s ease;
-ms-transition: -ms-transform 0.5s ease;
transition: transform 0.5s ease;
display: block;
height: 44px;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 10001;
text-align: center;
color: #fff;
font-size: 1.25em;
background-color: #007294;
}
#titleBar .title {
line-height: 44px;
}
#titleBar .toggle {
position: absolute;
top: 0;
left: 0;
width: 80px;
height: 60px;
}
#titleBar .toggle:after {
content: '';
position: absolute;
left: 4px;
top: 4px;
color: #fff;
text-align: center;
line-height: 31px;
font-size: 0.8em;
width: 50px;
height: 35px;
border-radius: 5px;
box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.25), inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), inset 0px 6px 13px 0px rgba(255, 255, 255, 0.2), 0px 2px 2px 0px rgba(255, 255, 255, 0.1);
}
#titleBar .toggle:before {
content: '';
position: absolute;
width: 20px;
height: 30px;
background: url("images/mobileUI-site-nav-opener-bg.svg");
top: 16px;
left: 19px;
}
#titleBar .toggle:active:after {
background: rgba(0, 0, 0, 0.2);
}
#navPanel {
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-moz-transform: translateX(-275px);
-webkit-transform: translateX(-275px);
-ms-transform: translateX(-275px);
transform: translateX(-275px);
-moz-transition: -moz-transform 0.5s ease;
-webkit-transition: -webkit-transform 0.5s ease;
-ms-transition: -ms-transform 0.5s ease;
transition: transform 0.5s ease;
display: block;
height: 100%;
left: 0;
overflow-y: auto;
position: fixed;
top: 0;
width: 275px;
z-index: 10002;
background: #00536F;
color: #fff;
box-shadow: inset -10px 0px 40px 0px rgba(0, 0, 0, 0.5);
}
#navPanel .link {
display: block;
color: #fff;
border-top: solid 1px rgba(255, 255, 255, 0.1);
border-bottom: solid 1px rgba(0, 0, 0, 0.2);
height: 55px;
line-height: 55px;
padding: 0 15px 0 15px;
text-decoration: none;
}
#navPanel .link:first-child {
border-top: 0;
}
#navPanel .link:last-child {
border-bottom: 0;
}
body.navPanel-visible #page-wrapper {
-moz-transform: translateX(275px);
-webkit-transform: translateX(275px);
-ms-transform: translateX(275px);
transform: translateX(275px);
}
body.navPanel-visible #titleBar {
-moz-transform: translateX(275px);
-webkit-transform: translateX(275px);
-ms-transform: translateX(275px);
transform: translateX(275px);
}
body.navPanel-visible #navPanel {
-moz-transform: translateX(0);
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
}
If there is more code that you think needs to be shown, you can find it by downloading the template.
The logo img is not showing up on the mobile site because the logo image is stored on your local C drive, not on the server.
<img class="logo" id="logo" src="C:\Users\test\Desktop\html5up-minimaxing\images\logo.png" width="250">
Upload your image on your image hose server, and replace the local image path with the url.
for example:
<img class="logo" id="logo" src="https://stackoverflow.design/assets/img/logos/so/logo-stackoverflow.png" width="250">
*if you don't have any image hosting service, here's the link about
how to host your image using google drive.

Creating ::after pseudo element causing problems with backface-visibility

I'm trying to create a flip card that has a shadow that fades in and out as it flips. I've read that the most efficient way (in terms of rendering) to animate a shadow is to create an ::after pseudo element with opacity of 0 and fade the shadow in. I'm attaching two snippets, one without the shadows that works fine, and the second that has the shadows and has a weird effect. Essentially, when the pseudo elements are there, the backface-visiblity property seems to glitch (or I'm missing something) but basically the back of the card shows immediately before it's even flipped over. I've slowed down the animation and added a red shadow to the back of the card so that it's easy to see what all is happening.
Thanks in advance.
.card {
perspective: 50rem;
background-color: #fff;
box-shadow: 5px 10px 10px rgba(51, 51, 51, 0.8);
width: 200px;
height: 300px;}
.card--flip {
background: none;
box-shadow: none; }
.card__side {
height: 400px;
width: 100%;
box-shadow: none;
background-color: #777;
transition: all 3s ease;
position: absolute;
top: 0;
left: 0;
backface-visibility: hidden; }
.card__side--front::after {
box-shadow: 5px 10px 10px rgba(51, 51, 51, 0.8);
opacity: 1;
transition: all 3s ease; }
.card__side--back {
transform: rotateY(-180deg); }
.card__side--back::after {
box-shadow: 5px 10px 10px rgba(255, 0, 0, 0.8);
opacity: 0;
transition: all 3s ease; }
.card:hover .card__side--front {
transform: rotateY(180deg); }
.card:hover .card__side--front::after {
opacity: 0; }
.card:hover .card__side--back {
transform: rotateY(0); }
.card:hover .card__side--back::after {
opacity: 1; }
.card__header {
padding: 2rem; }
.card__main {
padding: 2rem; }
WORKING
<div class="card card--flip">
<div class="card__side card__side--front">
<div class="card__header">
<h1>FRONT</h1>
</div>
<div class="card__main">front</div>
</div>
<div class="card__side card__side--back">
<div class="card__header">
<h1>BACK</h1>
</div>
<div class="card__main">back</div>
</div>
</div>
.card {
height: 400px;
width: 200px;
perspective: 50rem;
background-color: #fff;
box-shadow: 5px 10px 10px rgba(51, 51, 51, 0.8); }
.card--flip {
background: none;
box-shadow: none; }
.card__side {
width: 100%;
box-shadow: none;
background-color: #777;
transition: all 3s ease;
position: absolute;
top: 0;
left: 0;
backface-visibility: hidden; }
/* ADDED PSEUDO ELEMENT */
.card__side::after {
content: "";
position: absolute;
top: 0;
left: 0;
z-index: -10;
width: 100%;
height: 100%; }
.card__side--front::after {
box-shadow: 5px 10px 10px rgba(51, 51, 51, 0.8);
opacity: 1;
transition: all 3s ease; }
.card__side--back {
transform: rotateY(-180deg); }
.card__side--back::after {
box-shadow: 5px 10px 10px rgba(255, 0, 0, 0.8);
opacity: 0;
transition: all 3s ease; }
.card:hover .card__side--front {
transform: rotateY(180deg); }
.card:hover .card__side--front::after {
opacity: 0; }
.card:hover .card__side--back {
transform: rotateY(0); }
.card:hover .card__side--back::after {
opacity: 1; }
.card__header {
padding: 2rem; }
.card__main {
padding: 2rem; }
NOT WORKING
(added pseudo ::after class)
<div class="card card--flip">
<div class="card__side card__side--front">
<div class="card__header">
<h1>FRONT</h1>
</div>
<div class="card__main">front</div>
</div>
<div class="card__side card__side--back">
<div class="card__header">
<h1>BACK</h1>
</div>
<div class="card__main">back</div>
</div>
</div>
Add the following to your class:
.card {
...
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}

CSS : animating another div with ~ or + on div element hover

I've tried many approaches to get this working correctly, but with no success.. I notice that this question has been asked a few times already, and i've tried the solutions i've found.. but with no success..
So i'll upfront say sorry if someone of you find this question as a duplicate :(
The hovered element is "food-box", and the element which needs the scale-animation is "food-box-image" :
<div class="food-box">
<div class="food-box-image" style="background-image: url(myimage.jpg);"></div>
... and i'm trying to get the animation working like this :
.food-box:hover ~ .foox-box-image {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
border:8px solid red;
}
but it will not fire :
the only way i got it working, is with specifying .food-box-image:hover, but then it will not fire when hovering the needed div element..
Here's complete code (which runs) :
Anyone know how to do this ?
.fixedbuttons-container {
position: absolute;
width: 100%;
}
.buttons,
.fixedbuttons {
display: flex;
flex-flow: row wrap;
}
.fixedbuttons > * {
width: 25%;
}
.fixedbuttons > * > * {
width: 100%;
text-align: center;
}
.food-box-container {
padding: 10px;
}
.food-box {
flex: 1;
position: relative;
background-color: white;
min-height: 300px;
background-color: #ffffff;
-webkit-box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
-moz-box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
border-color: #666666;
border: 1px solid #666666;
word-wrap: break-word;
margin: 0 !important;
padding: 0 !important;
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box:hover {
cursor: pointer;
-webkit-box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
-moz-box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box:hover ~ .foox-box-image {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
border:8px solid red;
}
.food-box .food-box-image {
position: absolute top: 0 left: 0;
background-size: cover;
width: 100%;
min-height: 150px;
background-color: #ffffff;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.food-box .food-box-content {
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
position: absolute bottom: 0 left: 0;
word-wrap: break-word;
width: 100%;
min-height: 150px;
background-color: #ffd531;
color: #000000;
font-size: 80%;
padding-top: 60px;
padding-left: 5px;
padding-right: 5px;
}
.food-box:hover > .food-box .food-box-content {
background: yellow !important;
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box .food-box-badge {
display: table;
background: #ffffff !important;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100px;
height: 100px;
line-height: 100px;
border-radius: 50%;
font-size: 12px;
color: #000000;
text-align: center;
-webkit-box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
border-color: #d3e0e9;
border: 1px solid #b3c9e5;
padding-left: 10px;
padding-right: 10px;
}
.food-box .food-box-badge span {
color: #666;
display: table-cell;
vertical-align: middle;
line-height: 1.2em;
word-wrap: break-word;
}
<div class="fixedbuttons-container">
<div class="fixedbuttons">
<div>
<a>
<div class="food-box-container">
<div class="food-box">
<div class="food-box-image" style="background-image: url(https://assets.epicurious.com/photos/57c5c6d9cf9e9ad43de2d96e/master/pass/the-ultimate-hamburger.jpg);"></div>
<div class="food-box-badge"><span>Sydhavsmeny</span></div>
<div class="food-box-content">
adslkfjaølkfj
</div>
</div>
</div>
</a>
</div>
<div>
<a>
<div class="food-box-container">
<div class="food-box">
<div class="food-box-image scalable" style="background-image: url(https://assets.epicurious.com/photos/57c5c6d9cf9e9ad43de2d96e/master/pass/the-ultimate-hamburger.jpg);"></div>
<div class="food-box-badge"><span>Sydhavsmeny</span></div>
<div class="food-box-content">
adslkfjaølkfj
</div>
</div>
</div>
</a>
</div>
</div </div>
The first is the typo foox* to be replaced with .food-box:hover > .foox-box-image as pointed out by #panther
Now if you want to only scale within the container box apply overflow: hidden to the wrapping container which is food-box
Hope this is what you are expecting.
.fixedbuttons-container {
position: absolute;
width: 100%;
}
.buttons,
.fixedbuttons {
display: flex;
flex-flow: row wrap;
}
.fixedbuttons > * {
width: 25%;
}
.fixedbuttons > * > * {
width: 100%;
text-align: center;
}
.food-box-container {
padding: 10px;
}
.food-box {
overflow: hidden;
flex: 1;
position: relative;
background-color: white;
min-height: 300px;
background-color: #ffffff;
-webkit-box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
-moz-box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
box-shadow: 0px 0px 20px 4px rgba(0, 0, 0, 0.35);
border-color: #666666;
border: 1px solid #666666;
word-wrap: break-word;
margin: 0 !important;
padding: 0 !important;
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box:hover {
cursor: pointer;
-webkit-box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
-moz-box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
box-shadow: 0px 0px 20px 4px rgba(255, 255, 255, 0.35);
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box:hover > .food-box-image {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
.food-box .food-box-image {
position: absolute top: 0 left: 0;
background-size: cover;
width: 100%;
min-height: 150px;
background-color: #ffffff;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.food-box .food-box-content {
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
position: absolute bottom: 0 left: 0;
word-wrap: break-word;
width: 100%;
min-height: 150px;
background-color: #ffd531;
color: #000000;
font-size: 80%;
padding-top: 60px;
padding-left: 5px;
padding-right: 5px;
}
.food-box:hover > .food-box .food-box-content {
background: yellow !important;
-moz-transition: all .1s ease-in;
-o-transition: all .1s ease-in;
-webkit-transition: all .1s ease-in;
transition: all .1s ease-in;
}
.food-box .food-box-badge {
display: table;
background: #ffffff !important;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 100px;
height: 100px;
line-height: 100px;
border-radius: 50%;
font-size: 12px;
color: #000000;
text-align: center;
-webkit-box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 39px 4px rgba(0, 0, 0, 0.75);
border-color: #d3e0e9;
border: 1px solid #b3c9e5;
padding-left: 10px;
padding-right: 10px;
}
.food-box .food-box-badge span {
color: #666;
display: table-cell;
vertical-align: middle;
line-height: 1.2em;
word-wrap: break-word;
}
<div class="fixedbuttons-container">
<div class="fixedbuttons">
<div>
<a>
<div class="food-box-container">
<div class="food-box">
<div class="food-box-image" style="background-image: url(https://assets.epicurious.com/photos/57c5c6d9cf9e9ad43de2d96e/master/pass/the-ultimate-hamburger.jpg);"></div>
<div class="food-box-badge"><span>Sydhavsmeny</span></div>
<div class="food-box-content">
adslkfjaølkfj
</div>
</div>
</div>
</a>
</div>
<div>
<a>
<div class="food-box-container">
<div class="food-box">
<div class="food-box-image scalable" style="background-image: url(https://assets.epicurious.com/photos/57c5c6d9cf9e9ad43de2d96e/master/pass/the-ultimate-hamburger.jpg);"></div>
<div class="food-box-badge"><span>Sydhavsmeny</span></div>
<div class="food-box-content">
adslkfjaølkfj
</div>
</div>
</div>
</a>
</div>
</div </div>

how to use nested transitions with sass

I have this sass transitions:
.card{
transition: all 0.5s ease;
position: relative;
height: auto;
}
.artistInfo{display: none;}
.card:hover{
box-shadow: 10px 10px rgba(128, 128, 128, 0.37);
margin-top: -3%;
.artistInfo{
display: block;
}
}
the hovers works fine, and the transitions works too except for the .artistInfo transition.
You can't animate display property. What you can do is animate opacity
.card {
transition: all 0.5s ease;
position: relative;
height: auto;
}
.artistInfo {
opacity: 0;
position: absolute;
}
.card:hover {
box-shadow: 10px 10px rgba(128, 128, 128, 0.37);
margin-top: -3%;
&+.artistInfo {
opacity: 1;
}
}
http://codepen.io/anon/pen/XMLvqZ
Maybe is because "}" is in the incorrect place for ".card:hover"
correct:
.card{
transition: all 0.5s ease;
position: relative;
height: auto;
}
.artistInfo{display: none;}
.card:hover{
box-shadow: 10px 10px rgba(128, 128, 128, 0.37);
margin-top: -3%;
}
.artistInfo{
display: block;
}
Your nesting is correct you just don't have a transition on your '.artistInfo' class. Updating to this should work:
.card{
transition: all 0.5s ease;
position: relative;
height: auto;
}
.artistInfo{
opacity: 0;
display:none;
transition: all 0.5s ease
}
.card:hover{
box-shadow: 10px 10px rgba(128, 128, 128, 0.37);
margin-top: -3%;
.artistInfo{
opacity: 1;
display: block;
transition: all 0.5s ease
}
}