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>
Related
I would like to change the background color from all the div under the div with class=hamburger-react.
I don't have access to this piece of html, so I need to target the good div and !important override.
I tried with :
div.close-overlay-btn:nth-child(2) {
background: rgba(0, 100, 172, 0.411) !important;
}
<div class="close-overlay-btn">
<div class="hamburger-react" aria-expanded="true" role="button" tabindex="0" style="cursor: pointer; height: 48px; position: relative; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; user-select: none; width: 48px; outline: none; transform: rotate(-180deg);">
<div style="background: #dc3545;height: 3px;left: 8px;position: absolute;width: 32px;top: 13px;transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s;transform: rotate(-45deg) translate(-7.07px, 7.07px);"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 23px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; opacity: 0;"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 33px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; transform: rotate(45deg) translate(-7.07px, -7.07px);"></div>
</div>
</div>
But didnt work.
Any tips ? since these div have no class it's a little bit more complicated than expected
Your reference in your selectors is invalid. Try this:
.close-overlay-btn>.hamburger-react>div {}
There is no :nth-child(2) to .close-overlay-btn.
.close-overlay-btn is the grandparent, .hamburger-react is the parent, and all of the other divs nested in .hamburger-react are the children to the parent.
.close-overlay-btn>.hamburger-react>div {
background: rgba(0, 100, 172, 0.411) !important;
}
<div class="close-overlay-btn">
<div class="hamburger-react" aria-expanded="true" role="button" tabindex="0" style="cursor: pointer; height: 48px; position: relative; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; user-select: none; width: 48px; outline: none; transform: rotate(-180deg);">
<div style="background: #dc3545;height: 3px;left: 8px;position: absolute;width: 32px;top: 13px;transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s;transform: rotate(-45deg) translate(-7.07px, 7.07px);"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 23px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; opacity: 0;"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 33px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; transform: rotate(45deg) translate(-7.07px, -7.07px);"></div>
</div>
</div>
If you really can't access/change the HTML, then the easy way is really using !important (which I do not advise in general) Solution 1
Other - better - solution, is remove the inline styles with JavaScript - and implement the same CSS but without !important Solution 2
You are using your selector the wrong way, try this:
.hamburger-react div
This will affect every div child of .hamburger-react
Solution 1
.hamburger-react div {
background: rgba(0, 100, 172, 0.411) !important;
}
<div class="close-overlay-btn">
<div class="hamburger-react" aria-expanded="true" role="button" tabindex="0" style="cursor: pointer; height: 48px; position: relative; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; user-select: none; width: 48px; outline: none; transform: rotate(-180deg);">
<div style="background: #dc3545;height: 3px;left: 8px;position: absolute;width: 32px;top: 13px;transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s;transform: rotate(-45deg) translate(-7.07px, 7.07px);"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 23px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; opacity: 0;"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 33px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; transform: rotate(45deg) translate(-7.07px, -7.07px);"></div>
</div>
</div>
Solution 2
document.querySelectorAll('.hamburger-react div').forEach(el => el.style.removeProperty('background'))
.hamburger-react div {
background: rgba(0, 100, 172, 0.411);
}
<div class="close-overlay-btn">
<div class="hamburger-react" aria-expanded="true" role="button" tabindex="0" style="cursor: pointer; height: 48px; position: relative; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; user-select: none; width: 48px; outline: none; transform: rotate(-180deg);">
<div style="background: #dc3545;height: 3px;left: 8px;position: absolute;width: 32px;top: 13px;transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s;transform: rotate(-45deg) translate(-7.07px, 7.07px);"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 23px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; opacity: 0;"></div>
<div style="background: rgb(255, 221, 2); height: 3px; left: 8px; position: absolute; width: 32px; top: 33px; transition: all 0.4s cubic-bezier(0, 0, 0, 1) 0s; transform: rotate(45deg) translate(-7.07px, -7.07px);"></div>
</div>
</div>
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>
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>
I'm still new in coding, so you'll see some unnecessary codes in the css..
My problem is, I want to make the background stays/static when hovered, I believe my hover style is called "slide".. But when I hover on, the background did hover too. So, I need a help on how to make the background static when hovered.
p/s: please remain the margin for avpb :)
CSS:
#avpb {
background: rgba(0, 0, 0, 0.6);
width: 160px;
height: 220px;
border: 1px solid #000000;
padding: 19.5px;
margin-top: -10px;
margin-left: 555px;
position: absolute;
}
#avp {
position: absolute;
width: 160px;
height: 220px;
}
#avp img {
position: absolute;
z-index: 0;
}
.overlay {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
-webkit-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-o-transition:all .3s ease-out;
transition:all .3s ease-out;
}
#avp:hover > .overlay {
opacity: 1;
width: 160px;
height: 220px
height:auto;
background: rgba(0, 0, 0, 0.6);
-webkit-transform:translate(0px,10px);
-moz-transform:translate(0px,10px);
-ms-transform:translate(0px,10px);
-o-transform:translate(0px,10px);
transform:translate(0px,10px);
}
.button {
width: 160px;
height: 220px;
position: absolute;
}
.button a {
font-family: Lato;
font-size: 10px;
letter-spacing: 1px;
width: 80px;
height: 25px;
line-height: 25px;
margin-left: auto;
margin-right: auto;
background: rgba(0, 0, 0, 0.6);
border: 1px solid #000000;
text-align: center;
text-decoration: none;
padding: 5px;
color: #ffffff !important;
display: block;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-o-transition: 0.5s ease;
-ms-transition: 0.5s ease;
}
.button a:hover {
background: rgba(0, 0, 0, 0.6);
border: 1px solid #4cd1db;
color: #4cd1db !important;
text-decoration: none;
letter-spacing: 2px;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-o-transition: 0.5s ease;
-ms-transition: 0.5s ease;
}
HTML:
<div id="avpb">
<div id="avp">
<img src="http://www.imvu.com/catalog/web_av_pic.php?u=87116145">
<div class="overlay">
<div class="button">
<br>
<br>
add
<br>
message
</div>
</div>
</div>
</div>
Here's a JSFiddle
You should just let the .button transform then. I added some styles to your css file, hard to explain, just try and compare it with your original code :).
#avpb {
background: rgba(0, 0, 0, 0.6);
width: 160px;
height: 220px;
border: 1px solid #000000;
padding: 19.5px;
margin-top: -10px;
margin-left: 555px;
position: absolute;
}
#avp {
position: absolute;
width: 160px;
height: 220px;
}
#avp img {
position: absolute;
z-index: 0;
}
.overlay {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
.button{
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-ms-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
transition: all .3s ease-out;
}
#avp:hover>.overlay {
opacity: 1;
width: 160px;
height: 220px height:auto;
background: rgba(0, 0, 0, 0.6);
}
#avp:hover>.overlay>.button {
opacity: 1;
width: 160px;
height: 220px height:auto;
-webkit-transform: translate(0px, 10px);
-moz-transform: translate(0px, 10px);
-ms-transform: translate(0px, 10px);
-o-transform: translate(0px, 10px);
transform: translate(0px, 10px);
}
.button {
width: 160px;
height: 220px;
position: absolute;
}
.button a {
font-family: Lato;
font-size: 10px;
letter-spacing: 1px;
width: 80px;
height: 25px;
line-height: 25px;
margin-left: auto;
margin-right: auto;
background: rgba(0, 0, 0, 0.6);
border: 1px solid #000000;
text-align: center;
text-decoration: none;
padding: 5px;
color: #ffffff !important;
display: block;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-o-transition: 0.5s ease;
-ms-transition: 0.5s ease;
}
.button a:hover {
background: rgba(0, 0, 0, 0.6);
border: 1px solid #4cd1db;
color: #4cd1db !important;
text-decoration: none;
letter-spacing: 2px;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-o-transition: 0.5s ease;
-ms-transition: 0.5s ease;
}
<div id="avpb">
<div id="avp">
<img src="http://www.imvu.com/catalog/web_av_pic.php?u=87116145">
<div class="overlay">
<div class="button">
<br>
<br>
add
<br>
message
</div>
</div>
</div>
</div>
You are transforming/translating the div to be 10 pixels down:
-webkit-transform:translate(0px,10px);
-moz-transform:translate(0px,10px);
-ms-transform:translate(0px,10px);
-o-transform:translate(0px,10px);
transform:translate(0px,10px);
Delete these and it should work fine.
I have 3 boxes inside my section3holdingbox and I want it so if a user clicks on one of the boxes for it to change to a darker shade of red and let it stay like that until he clicks another box. also for the first box to be pre selected has a darker red. heres my code so far, i couldn't get it to work
HTML:
<div class="section3HoldingBox">
<div class="section3Box1">
<a href="#section3"><div class="section3BoxTitleBasic">Basic</div> <!-- end of section3BoxTitleBasic -->
</div></a><!-- end of section3Box1 -->
<div class="section3Box2">
<div class="section3BoxTitleComingSoon">Professional</div> <!-- end of section3BoxTitles -->
</div> <!-- end of section3Box2 -->
<div class="section3Box3">
<div class="section3BoxTitleComingSoon">Deluxe</div> <!-- end of section3BoxTitles -->
</div> <!-- end of section3Box3 -->
</div> <!-- end of section3HoldingBox -->
CSS:
.section3HoldingBox {
width: 1350px;
height: 210px;
margin: 25px auto 0;
padding: 0;
border: blue 2px solid;
}
.section3HoldingBox a {
text-decoration: none;
}
.section3HoldingBox a:active {
}
.section3Box1 {
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .2);
float: left;
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box2 {
float: left;
margin-left: 219px;
text-align: center;
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .12);
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box3 {
float: left;
margin-left: auto;
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .12);
float: right;
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box1:hover, .section3Box2:hover, .section3Box3:hover {
border: 2.2px rgba(231, 76, 60, .83) solid;
background-color: rgba(231, 76, 60, .17)
}
The CSS :target pseudo-class is an efficient solution for this kind of problem.
Once you have set up your :target pseudo-class style rules, you'll also need to add a short one-line javascript, so that the first box is pre-selected as soon as the window loads.
function initialise() {
window.location.hash = 'box1';
}
window.onload = initialise();
.section3HoldingBox {
width: 1350px;
height: 210px;
margin: 25px auto 0;
padding: 0;
border: blue 2px solid;
}
.section3HoldingBox a {
text-decoration: none;
}
.section3Box1 {
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .2);
float: left;
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box2 {
float: left;
margin-left: 219px;
text-align: center;
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .12);
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box3 {
float: left;
margin-left: auto;
width: 300px;
height: 200px;
border-radius: 9px;
border: 2.2px rgba(231, 76, 60, .38) solid;
background-color: rgba(231, 76, 60, .12);
float: right;
-webkit-transition: .5s ease-in-out;
-moz-transition:.5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
.section3Box1:hover, .section3Box2:hover, .section3Box3:hover {
border: 2.2px rgba(231, 76, 60, .83) solid;
background-color: rgba(231, 76, 60, .17)
}
div[id^=box] a {
display: block;
height: 100%;
text-align: center;
}
div[id^=box]:target {
border: 2.2px rgba(63, 0, 0, 1) solid;
background-color: rgba(127, 0, 0, 1)
}
div[id^=box]:target a {
color: rgba(255, 255, 255, 1)
}
<div class="section3HoldingBox">
<div class="section3Box1" id="box1">
<a href="#box1">
<div class="section3BoxTitleBasic">Basic</div>
</a>
</div>
<div class="section3Box2" id="box2">
<a href="#box2">
<div class="section3BoxTitleComingSoon">Professional</div>
</a>
</div>
<div class="section3Box3" id="box3">
<a href="#box3">
<div class="section3BoxTitleComingSoon">Deluxe</div>
</a>
</div>
</div>