This question already has answers here:
Creating a Zoom Effect on an image on hover using CSS?
(13 answers)
Closed last year.
I am trying to have a text slide up with an overlay but the problem that the overlay is sliding up with the text together what i really want is the overlay to be zoom in effect with the image and the text slide up here is an exemple that i am working on and i still can't achieve it.
Codepen exemple minus the zoom in effect
.clients {
position: relative;
}
.client-container {
position: relative;
width: 100%;
overflow: hidden;
}
.client-container .product-desc {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: left;
align-items: center;
color: #fff;
background-color: rgba(0, 0, 0, 0.6);
text-align: right;
padding: 14em 0.4em 0.2em;
-webkit-transform: translateY(101%);
transform: translateY(101%);
transition: -webkit-transform 0.8s ease-in-out;
transition: transform 0.8s ease-in-out;
transition: transform 0.8s ease-in-out, -webkit-transform 0.8s ease-in-out;
}
.client-container:hover .product-desc {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.client-container .product-desc2 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: left;
align-items: center;
color: #fff;
text-align: right;
padding: 17em 0.4em 0.2em;
-webkit-transform: translateY(101%);
transform: translateY(101%);
transition: -webkit-transform 1s ease-in-out;
transition: transform 1s ease-in-out;
transition: transform 1s ease-in-out, -webkit-transform 1s ease-in-out;
}
.client-container:hover .product-desc2 {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.brand-img {
display: block;
max-width: 100%;
height: auto;
transform: scale(1);
-ms-transform: scale(1);
-moz-transform: scale(1);
-webkit-transform: scale(1);
-o-transform: scale(1);
-webkit-transition: all 1.5s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.clients:hover .brand-img {
cursor: pointer;
transform: scale(1.5);
-ms-transform: scale(1.5);
-moz-transform: scale(1.5);
-webkit-transform: scale(1.2);
-o-transform: scale(1.5);
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div class="clients BRANDING col-6 col-md-4 col-lg-3 col-lg-3">
<a href="#">
<figure class="client-container">
<img class="img-fluid brand-img" src="https://www.wrappixel.com/demos/ui-kit/wrapkit/assets/images/team/t3.jpg" alt="Logo">
<figcaption class="product-desc">
<P>paragraphparagraphparagraph</P>
</figcaption>
<figcaption class="product-desc2">
<h4>text</h4>
</figcaption>
</figure>
</a>
</div>
You could add a pseudo to the container, in that way the background "is there" and does its job of fading in when needed. That way the text is its own entity and you are free to style both just the way you want it. I added
.client-container::after
.client-container:hover::after
and removed the background-color on the first fig caption.
.clients {
position: relative;
}
.client-container {
position: relative;
width: 100%;
overflow: hidden;
}
.client-container::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.5);
opacity: 0;
visibility: hidden;
z-index: 0;
}
.client-container:hover::after {
opacity: 1;
visibility: visible;
transition: opacity 350ms;
}
.product-desc {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: left;
align-items: center;
color: #fff;
text-align: right;
padding: 14em 0.4em 0.2em;
-webkit-transform: translateY(101%);
transform: translateY(101%);
transition: -webkit-transform 0.8s ease-in-out;
transition: transform 0.8s ease-in-out;
transition: transform 0.8s ease-in-out, -webkit-transform 0.8s ease-in-out;
z-index: 1;
}
.client-container:hover .product-desc {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.product-desc2 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: left;
align-items: center;
color: #fff;
text-align: right;
padding: 17em 0.4em 0.2em;
-webkit-transform: translateY(101%);
transform: translateY(101%);
transition: -webkit-transform 1s ease-in-out;
transition: transform 1s ease-in-out;
transition: transform 1s ease-in-out, -webkit-transform 1s ease-in-out;
z-index: 1;
}
.client-container:hover .product-desc2 {
-webkit-transform: translateY(0);
transform: translateY(0);
}
.brand-img {
display: block;
max-width: 100%;
height: auto;
transform: scale(1);
-ms-transform: scale(1);
-moz-transform: scale(1);
-webkit-transform: scale(1);
-o-transform: scale(1);
-webkit-transition: all 1.5s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.clients:hover .brand-img {
cursor: pointer;
transform: scale(1.5);
-ms-transform: scale(1.5);
-moz-transform: scale(1.5);
-webkit-transform: scale(1.2);
-o-transform: scale(1.5);
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div class="clients BRANDING col-6 col-md-4 col-lg-3 col-lg-3">
<a href="#">
<figure class="client-container">
<img class="img-fluid brand-img" src="https://www.wrappixel.com/demos/ui-kit/wrapkit/assets/images/team/t3.jpg" alt="Logo">
<figcaption class="product-desc">
<P>paragraphparagraphparagraph</P>
</figcaption>
<figcaption class="product-desc2">
<h4>text</h4>
</figcaption>
</figure>
</a>
</div>
I'm having some trouble understanding what it is you're trying to accomplish. What I think you want is that when a client hovers over the image that there is a small zoom and that some text comes slide-upwards. But you don't want them to see the overlay right?
If that's the case just keep your code the same but change background-color: rgba(0, 0, 0, 0.6);to background-color: transparent;.
Related
I'm using a lightbox system on a page and I'm trying to get an image to go half inside the content of the lightbox and half above it - Like This
I've been editing some of the css to add z-index but that isnt helping.
Current HTML
<div class="nivo-lightbox-content"><div class="nivo-lightbox-inline" style="position: relative; top: 50%; margin-top: -281.95px;"><div id="s-b" style="" class="popuptxt">
<img src="https://example.com/b/wp-content/uploads/2022/05/s_b_popup.jpg" class="popupimg"><br>
<h3>SB</h3>
<h4>MD</h4>
<img loading="lazy" src="https://example.com/b/wp-content/uploads/2022/05/logo.png" width="65px" height="65px"><br>
Test Text<br>
all goes here.
</div></div></div><div class="nivo-lightbox-title-wrap"></div>
and CSS Code
.nivo-lightbox-overlay {
position: fixed;
top: 0;
left: 0;
z-index: 99998;
width: 100%;
height: 100%;
overflow: hidden;
visibility: hidden;
opacity: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.nivo-lightbox-overlay.nivo-lightbox-open {
visibility: visible;
opacity: 1;
}
.nivo-lightbox-wrap {
position: absolute;
top: 10%;
bottom: 10%;
left: 10%;
right: 10%;
}
.nivo-lightbox-content {
width: 100%;
height: 100%;
}
.nivo-lightbox-title-wrap {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
z-index: 99999;
text-align: center;
}
.nivo-lightbox-nav { display: none; }
.nivo-lightbox-prev {
position: absolute;
top: 50%;
left: 0;
}
.nivo-lightbox-next {
position: absolute;
top: 50%;
right: 0;
}
.nivo-lightbox-close {
position: absolute;
top: 2%;
right: 2%;
}
.nivo-lightbox-image { text-align: center; }
.nivo-lightbox-image img {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
vertical-align: middle;
}
.nivo-lightbox-content iframe {
width: 100%;
height: 100%;
}
.nivo-lightbox-inline,
.nivo-lightbox-ajax {
max-height: 100%;
overflow: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
/* https://bugzilla.mozilla.org/show_bug.cgi?id=308801 */
}
.nivo-lightbox-error {
display: table;
text-align: center;
width: 100%;
height: 100%;
color: #fff;
text-shadow: 0 1px 1px #000;
}
.nivo-lightbox-error p {
display: table-cell;
vertical-align: middle;
}
/* Effects
**********************************************/
.nivo-lightbox-notouch .nivo-lightbox-effect-fade,
.nivo-lightbox-notouch .nivo-lightbox-effect-fadeScale,
.nivo-lightbox-notouch .nivo-lightbox-effect-slideLeft,
.nivo-lightbox-notouch .nivo-lightbox-effect-slideRight,
.nivo-lightbox-notouch .nivo-lightbox-effect-slideUp,
.nivo-lightbox-notouch .nivo-lightbox-effect-slideDown,
.nivo-lightbox-notouch .nivo-lightbox-effect-fall {
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
/* fadeScale */
.nivo-lightbox-effect-fadeScale .nivo-lightbox-wrap {
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
-webkit-transform: scale(0.7);
-moz-transform: scale(0.7);
-ms-transform: scale(0.7);
transform: scale(0.7);
}
.nivo-lightbox-effect-fadeScale.nivo-lightbox-open .nivo-lightbox-wrap {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
/* slideLeft / slideRight / slideUp / slideDown */
.nivo-lightbox-effect-slideLeft .nivo-lightbox-wrap,
.nivo-lightbox-effect-slideRight .nivo-lightbox-wrap,
.nivo-lightbox-effect-slideUp .nivo-lightbox-wrap,
.nivo-lightbox-effect-slideDown .nivo-lightbox-wrap {
-webkit-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-moz-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-ms-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-o-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
}
.nivo-lightbox-effect-slideLeft .nivo-lightbox-wrap {
-webkit-transform: translateX(-10%);
-moz-transform: translateX(-10%);
-ms-transform: translateX(-10%);
transform: translateX(-10%);
}
.nivo-lightbox-effect-slideRight .nivo-lightbox-wrap {
-webkit-transform: translateX(10%);
-moz-transform: translateX(10%);
-ms-transform: translateX(10%);
transform: translateX(10%);
}
.nivo-lightbox-effect-slideLeft.nivo-lightbox-open .nivo-lightbox-wrap,
.nivo-lightbox-effect-slideRight.nivo-lightbox-open .nivo-lightbox-wrap {
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
.nivo-lightbox-effect-slideDown .nivo-lightbox-wrap {
-webkit-transform: translateY(-10%);
-moz-transform: translateY(-10%);
-ms-transform: translateY(-10%);
transform: translateY(-10%);
}
.nivo-lightbox-effect-slideUp .nivo-lightbox-wrap {
-webkit-transform: translateY(10%);
-moz-transform: translateY(10%);
-ms-transform: translateY(10%);
transform: translateY(10%);
}
.nivo-lightbox-effect-slideUp.nivo-lightbox-open .nivo-lightbox-wrap,
.nivo-lightbox-effect-slideDown.nivo-lightbox-open .nivo-lightbox-wrap {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
/* fall */
.nivo-lightbox-body-effect-fall .nivo-lightbox-effect-fall {
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
perspective: 1000px;
}
.nivo-lightbox-effect-fall .nivo-lightbox-wrap {
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
-webkit-transform: translateZ(300px);
-moz-transform: translateZ(300px);
-ms-transform: translateZ(300px);
transform: translateZ(300px);
}
.nivo-lightbox-effect-fall.nivo-lightbox-open .nivo-lightbox-wrap {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
Any ideas what I'm missing?
I'm pretty sure it should just be a case of adding z-index to a couple of the classes but nothing seems to work - I just seem to be able to hide the image or move the image but not get it to display.
I would like to achieve the following effect: below CSS, on hover, does a "slot machine effect" that rolls the icon in a vertical carousel (please see the css below for details).
Due to restrictions of hosting that I am using for my website, I cannot use any external library of icons, so I would like to achieve the same effect, pasting the css into the header and using it with an img tag in HTML.
Could you please help me trim this css so that it will actually work with my image?
Thank you for all your forbearance and help.
-webkit-transition:all .3s;
-o-transition:all .3s;
transition:all .3s
}
.btn.social_share:hover .social-media-share-buttons-icon:before {
top: 40px;
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s
}
.btn.social_share:hover .social-media-share-buttons-icon:after {
top: 0;
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s
}
.btn.social_share:active {
text-decoration: none!important;
-webkit-touch-callout: none
}
.btn.social_share:active .social-media-share-buttons-icon {
background-color: rgba(0, 0, 0, .2);
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s
}
.btn.social_share:active .social-media-share-buttons-icon:before {
top: 40px;
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s
}
.btn.social_share:active .social-media-share-buttons-icon:after {
top: 0;
-webkit-transition: all .3s;
-o-transition: all .3s;
transition: all .3s
}
.btn.social_share.facebook .social-media-share-buttons-icon:after,
.btn.social_share.facebook .social-media-share-buttons-icon:before {
content: "\e63f"
}
.btn.social_share.linkedin .social-media-share-buttons-icon:after,
.btn.social_share.linkedin .social-media-share-buttons-icon:before {
content: "\e631"
}
.btn.social_share.twitter .social-media-share-buttons-icon:after,
.btn.social_share.twitter .social-media-share-buttons-icon:before {
content: "\e640"
}
#-moz-keyframes fadeBottom {
0% {
opacity: 0;
-ms-transform: translateY(10%);
-webkit-transform: translateY(10%);
transform: translateY(10%)
}
100% {
opacity: 1;
-ms-transform: translateY(0);
-webkit-transform: translateY(0);
transform: translateY(0)
}
}
#-webkit-keyframes fadeBottom {
0% {
opacity: 0;
-ms-transform: translateY(10%);
-webkit-transform: translateY(10%);
transform: translateY(10%)
}
100% {
opacity: 1;
-ms-transform: translateY(0);
-webkit-transform: translateY(0);
transform: translateY(0)
}
}
#-o-keyframes fadeBottom {
0% {
opacity: 0;
-ms-transform: translateY(10%);
-webkit-transform: translateY(10%);
transform: translateY(10%)
}
100% {
opacity: 1;
-ms-transform: translateY(0);
-webkit-transform: translateY(0);
transform: translateY(0)
}
}
As requested, also adding the HTML snippet, which currently is not working with above css:
<div style="padding: 30px 0; padding-left: 0px; margin-left: 0px; margin-right: 0px; text-align: center">
<div class="col-xs-12">
<ul class="social-media-share-buttons">
<li>
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://www.mywebsite.com" class="btn btn-link social_share facebook" rel="nofollow" data-social_name="facebook" data-post_id="" data-social_type="share" data-location="inline">
<img class="social-media-share-buttons-icon" src="facebook_icon.png">
<div style="color: #fff; line-height: 2; font-weight: 700;">Facebook</div>
</a>
</li>
You don't need animations for that. Just use transitions and transforms and it works: Here some example:
ul {
text-align: center;
padding: 0;
}
li {
list-style-type: none;
}
a {
display: inline-block;
position: relative;
height: 40px;
background: #4456aa;
line-height: 40px;
overflow: hidden;
color: white;
text-decoration: none;
font-family: sans-serif;
border: 1px solid transparent;
transition: all 0.5s ease 0.5s;
}
a div {
padding: 0 30px;
}
a img {
transition: all ease 1s;
position: absolute;
top: 100%;
left: 0;
bottom: 0;
width: 30px;
margin: auto;
opacity: 0;
}
a:hover {
transition: all ease 0.5s;
}
a:hover {
background: #ffffff;
border: 1px solid #000000;
color: #000000;
}
a:hover img {
transition: all 0.5s ease 0.5s;
opacity: 1;
top: 0;
bottom: 0;
}
<ul class="social-media-share-buttons">
<li>
<a target="_blank"
href="https://www.facebook.com/sharer/sharer.php?u=https://www.mywebsite.com"
class="btn btn-link social_share facebook"
rel="nofollow"
data-social_name="facebook"
data-post_id=""
data-social_type="share"
data-location="inline">
<img class="social-media-share-buttons-icon"
src="https://image.flaticon.com/icons/png/128/20/20837.png">
<div>Facebook</div>
</a>
</li>
</ul>
You may use pre-built CSS properties like transforms and transitions, maybe they make you independent of animations.
This menu in the middle of this page is working well, but on a Mac tablet (IOS system) it is giving this bug hover menu on Mac IOS. I suspect the problem to come from the "hover" function. Here is the html code :
.accueil2 {
text-align: center;
width: 70%;
}
.hover {
background-color: #fff;
}
.wrap {
position: relative;
width: 60vmin;
height: 60vmin;
margin: 0 auto;
top: -10vmin;
-webkit-transform: scale(0.2) translatez(0px);
transform: scale(0.2) translatez(0px);
opacity: 0;
-webkit-transition: opacity .5s, -webkit-transform .5s;
transition: opacity .5s, -webkit-transform .5s;
transition: transform .5s, opacity .5s;
transition: transform .5s, opacity .5s, -webkit-transform .5s;
-webkit-perspective: 800;
perspective: 800;
}
.a1,
.a2,
.a3,
.a4,
.a5 {
position: absolute;
left: 0;
top: 0;
width: 47.5%;
height: 47.5%;
overflow: hidden;
-webkit-transform: scale(.5) translateZ(0px);
transform: scale(.5) translateZ(0px);
background: #585247;
}
a .div1,
a .div2,
a .div3,
a .div4 {
height: 100%;
background-size: cover;
opacity: .5;
-webkit-transition: opacity .5s;
transition: opacity .5s;
border-radius: inherit;
}
a:nth-child(1) {
/*lien haut gauche*/
border-radius: 40vmin 0 0 0;
-webkit-transform-origin: 110% 110%;
transform-origin: 110% 110%;
-webkit-transition: -webkit-transform .4s .15s;
transition: -webkit-transform .4s .15s;
transition: transform .4s .15s;
transition: transform .4s .15s, -webkit-transform .4s .15s;
}
a:nth-child(1) div {
/*haut gauche*/
background: #E3DFD2;
}
a:nth-child(2) {
/*lien haut droite*/
border-radius: 0 40vmin 0 0;
left: 52.5%;
-webkit-transform-origin: -10% 110%;
transform-origin: -10% 110%;
-webkit-transition: -webkit-transform .4s .2s;
transition: -webkit-transform .4s .2s;
transition: transform .4s .2s;
transition: transform .4s .2s, -webkit-transform .4s .2s;
}
a:nth-child(2) div {
background: #E3DFD2;
}
a:nth-child(3) {
/*lien en bas à gauche*/
border-radius: 0 0 0 40vmin;
top: 52.5%;
-webkit-transform-origin: 110% -10%;
transform-origin: 110% -10%;
-webkit-transition: -webkit-transform .4s .25s;
transition: -webkit-transform .4s .25s;
transition: transform .4s .25s;
transition: transform .4s .25s, -webkit-transform .4s .25s;
}
a:nth-child(3) div {
background: #E3DFD2;
}
a:nth-child(4) {
/*lien en bas à droite*/
border-radius: 0 0 40vmin 0;
top: 52.5%;
left: 52.5%;
-webkit-transform-origin: -10% -10%;
transform-origin: -10% -10%;
-webkit-transition: -webkit-transform .4s .3s;
transition: -webkit-transform .4s .3s;
transition: transform .4s .3s;
transition: transform .4s .3s, -webkit-transform .4s .3s;
}
a:nth-child(4) div {
background: #E3DFD2;
}
.a5 {
/*lien centre*/
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50vmin;
box-shadow: 0 0 0 5vmin #E3DFD2;
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transition: -webkit-transform 1s;
-webkit-transform-style: preserve-3d;
}
#faceA {
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50%;
background: green;
}
#faceB {
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50%;
background: blue;
}
.a5.flipMe {
-webkit-transform: rotateY(180deg);
}
.spanout {
position: relative;
display: block;
margin: 0 auto;
top: 25vmin;
width: 10vmin;
height: 10vmin;
border-radius: 100%;
background: #585247;
-webkit-transform: translateZ(0px);
transform: translateZ(0px);
}
.spanin {
position: absolute;
width: 60%;
height: 3px;
background: #ACA696;
left: 20%;
top: 50%;
border-radius: 0;
}
.spanin:after,
.spanin:before {
content: '';
position: absolute;
left: 0;
top: -1.5vmin;
width: 100%;
height: 100%;
background: inherit;
}
.spanin:after {
top: 1.5vmin;
}
.spanout:hover+.wrap,
.wrap:hover {
-webkit-transform: scale(.8) translateZ(0px);
transform: scale(.8) translateZ(0px);
opacity: 1;
}
.spanout:hover+.wrap a,
.wrap:hover a {
-webkit-transform: scale(1) translatez(0px);
transform: scale(1) translatez(0px);
}
a:hover div {
opacity: 1;
-webkit-transform: translatez(0px);
transform: translatez(0px);
}
<div class="accueil2">
<span class="spanout">
<span class="spanin">
</span>
</span>
<div class="wrap">
<a href="#" class="a1">
<div class="div1"></div>
</a>
<a href="#" class="a2">
<div class="div2"></div>
</a>
<a href="#" class="a3">
<div class="div3"></div>
</a>
<a href="#" class="a4">
<div class="div4"></div>
</a>
<div class="a5">
<div id="faceA">A</div>
<div id="faceB">B</div>
</div>
</div>
</div>
I have some images, and on the :hover effect the figcaption should translateY, on chrome it works perfectly, but on the other browsers it shows the figcaption by default how you see below. Where I'm wrong? My website is on air in case of you want to see it by yourself: https://tiagosilveiraa.github.io
Bug on the other browsers:
Right Chrome:
HTML:
<div class="col-md-4 col-sm-6 col-xs-12">
<figure>
<img src="img/hidrau.png" alt="Hidraurio Mangueiras Hidraulicas" class="img-responsive">
<figcaption>
<button >Visitar</button>
<button >Github</button>
</figcaption>
</figure>
</div>
CSS:
#portfolio figure{
display: table;
position: relative;
overflow: hidden;
padding-bottom: 15px;
}
#portfolio img{
width: 100%;
max-width: 100%;
transition: all 0.4s ease;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
}
#portfolio figure figcaption{
overflow: hidden;
position: absolute;
bottom: -80px;
height: 80px;
width: 100%;
transition: all 0.4s ease;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
color: white;
background-color: #292929;
text-align: center;
justify-content: center;
padding-top: 15px;
}
#portfolio figure:hover figcaption {
transform: translateY(-90px);
-webkit-transform: translateY(-90px);
-moz-transform: translateY(-90px);
-ms-transform: translateY(-90px);
}
#portfolio figure:hover img {
opacity: 1;
transform: translateY(-50px);
-webkit-transform: translateY(-50px);
-moz-transform: translateY(-50px);
-ms-transform: translateY(-50px);
}
I have applied an effect to the image and when I hover over it it moves very strange, it is a move very small but I don't like it, also the text over the image moves when the mouse is out from the image.
This is my code, as you can see is a very imperceptible, but looks strange.
I also would like to make the images responsive when I change resolution, but I would like to have a height like 150px and make the image centered or crop it to the height.
This is my pen code: http://codepen.io/yunielth/pen/wWRydp
HTML
<div class="picture-block margin-0">
<div class="col-lg-3 col-md-6 sub-box-picture">
<div class="content-inner">
<div class="entry-thumbnail">
<div class="thumbnail"><a title="" href="/cursos/madrid"><img src="http://charitywp.thimpress.com/demo-4/wp-content/uploads/sites/6/2016/03/01_home_01_13-370x270.jpg"" alt="" title=""></a></div>
<a class="ciudades" title="" href="">Product 1</a>See more
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 sub-box-picture">
<div class="content-inner">
<div class="entry-thumbnail">
<div class="thumbnail"><a title="" href=""><img src="http://charitywp.thimpress.com/demo-4/wp-content/uploads/sites/6/2016/03/01_home_01_13-370x270.jpg"" alt="" title=""></a></div>
<a class="ciudades" title="" href="">Product 2</a>See more
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 hidden-xs sub-box-picture">
<div class="content-inner">
<div class="entry-thumbnail">
<div class="thumbnail"><a title="" href=""><img src="http://charitywp.thimpress.com/demo-4/wp-content/uploads/sites/6/2016/03/01_home_01_13-370x270.jpg"" alt="" title=""></a></div>
<a class="ciudades" title="" href="">Product 3</a>See more
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 hidden-xs sub-box-picture">
<div class="content-inner">
<div class="entry-thumbnail">
<div class="thumbnail"><a title="" href=""><img src="http://charitywp.thimpress.com/demo-4/wp-content/uploads/sites/6/2016/03/01_home_01_13-370x270.jpg"" alt="" title=""></a></div>
<a class="ciudades" title="" href="">Product 4</a>See more
</div>
</div>
</div>
</div>
CSS
.ciudades{
color: #ffffff;
display: table-cell;
font-size: 24px;
font-weight: 500;
line-height: 25px;
text-align: center;
text-shadow: 1px 2px #333;
vertical-align: middle;
width: 90%;
}
.sub-box-picture .content-inner {
border: none;
background-color: #FFF;
}
.sub-box-picture .entry-thumbnail {
position: relative;
overflow: hidden;
text-align: center;
}
.sub-box-picture .entry-thumbnail .thumbnail::before {
background: #000 none repeat scroll 0 0;
bottom: 0;
content: "";
left: 0;
opacity: 0;
position: absolute;
right: 0;
top: 0;
transition: all 0.3s ease 0s;
z-index: 2;
}
.sub-box-picture .thumbnail {
position: relative;
overflow: hidden;
padding: 0;
}
.sub-box-picture .thumbnail img {
width: 100%;
-webkit-transition: all 1s;
-moz-transition: all 1s;
-o-transition: all 1s;
-ms-transition: all 1s;
transition: all 1s;
-webkit-transition: all all 1s ease;
-moz-transition: all all 1s ease;
-ms-transition: all all 1s ease;
-o-transition: all all 1s ease;
transition: all all 1s ease;
}
.sub-box-picture .thumbnail {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
border: none;
}
.sub-box-picture .ciudades {
transform: translate(-50%,-50%) scale(1);
-webkit-transform: translate(-50%,-50%) scale(1);
-moz-transform: translate(-50%,-50%) scale(1);
-ms-transform: translate(-50%,-50%) scale(1);
-o-transform: translate(-50%,-50%) scale(1);
left: 50%;
position: absolute;
top: 50%;
z-index: 3;
}
.thim-button.style3 {
display: none;
}
.sub-box-picture a.ciudades {
color: #ffffff;
text-decoration: none;
}
.sub-box-picture:hover .entry-thumbnail .thumbnail::before {
-moz-opacity: .5;
-khtml-opacity: .5;
-webkit-opacity: .5;
opacity: .5;
-ms-filter: alpha(opacity=50);
filter: alpha(opacity=50);
}
.thim-button.style3 {
display: block;
}
.sub-box-picture:hover .thumbnail img {
transform: scale(1.1);
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
}
.sub-box-picture .thim-button.style3 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%) scale(0);
-webkit-transform: translate(-50%,-50%) scale(0);
-moz-transform: translate(-50%,-50%) scale(0);
-ms-transform: translate(-50%,-50%) scale(0);
-o-transform: translate(-50%,-50%) scale(0);
-webkit-transition: all .5s ease-in-out 0s;
-moz-transition: all .5s ease-in-out 0s;
-o-transition: all .5s ease-in-out 0s;
-ms-transition: all .5s ease-in-out 0s;
transition: all .5s ease-in-out 0s;
-webkit-transition: all .3s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
white-space: nowrap;
z-index: 3;
}
.sub-box-picture:hover .thim-button.style3 {
transform: translate(-50%,-50%) scale(1);
-webkit-transform: translate(-50%,-50%) scale(1);
-moz-transform: translate(-50%,-50%) scale(1);
-ms-transform: translate(-50%,-50%) scale(1);
-o-transform: translate(-50%,-50%) scale(1);
}
.sub-box-picture:hover .ciudades {
transform: translate(-50%,-50%) scale(0);
-webkit-transform: translate(-50%,-50%) scale(0);
-moz-transform: translate(-50%,-50%) scale(0);
-ms-transform: translate(-50%,-50%) scale(0);
-o-transform: translate(-50%,-50%) scale(0);
left: 50%;
position: absolute;
top: 50%;
visibility: hidden;
}
.thim-button.style3 {
background-color: #3080B2;
border-color: #3080B2;
color: #fff;
}
.thim-button.style3:hover {
background-color: #3080B2;
border-color: #3080B2;
text-decoration: none;
}
.thim-button {
border: none;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
font-size: 20px;
line-height: 36px;
padding: 0 20px;
display: inline-block;
}