Hover on iOS Safari - html

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>

Related

how to add zoom in image overlay on hover [duplicate]

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;.

how to have a zoom effect on hover

Well all i want is to have a slide up text with a zoom in light grey filter
so when i hover on the text slide up and a filter zoom in same motion as the image here is a codepen project it shows what i mean sadly i cant figure it out thanks in advance here is the link : Codepen exemple
Thanks in advance
.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 1sms ease-in-out;
transition: transform 1s ease-in-out;
transition: transform 1s ease-in-out, -webkit-transform 1sms 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 1sms ease-in-out;
transition: transform 1s ease-in-out;
transition: transform 1s ease-in-out, -webkit-transform 1sms 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);
}
<div class="clients 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://1757140519.rsc.cdn77.org/blog/wp-content/uploads/2013/06/jpg.png" alt="Logo">
<figcaption class="product-desc"><P>2022 all rights reserved</P></figcaption>
<figcaption class="product-desc2"><h4>name</h4></figcaption>
</figure>
</a>
</div>
Use the opacity: 0; to set your text invisible. You can now change the the opacity to 1 on the hover when you want to have it visible. For the zoom effect, you can use transform: scale(x);.
Here is an example with your code:
.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;
opacity: 0;
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;
}
.client-container:hover .product-desc {
cursor: pointer;
opacity: 1;
transform:scale(1.5);
-ms-transform:scale(1.5);
-moz-transform:scale(1.5);
-webkit-transform:scale(1.2);
-o-transform:scale(1.5);
}
.client-container .product-desc2 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: left;
align-items: center;
color: #fff;
opacity: 0;
text-align: right;
padding: 17em 0.4em 0.2em;
transition: -webkit-transform 1sms ease-in-out;
transition: transform 1s ease-in-out;
transition: transform 1s ease-in-out, -webkit-transform 1sms ease-in-out;
}
.client-container:hover .product-desc2 {
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);
opacity: 1;
}
.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);
}
<div class="clients 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://1757140519.rsc.cdn77.org/blog/wp-content/uploads/2013/06/jpg.png" alt="Logo">
<figcaption class="product-desc"><P>2022 all rights reserved</P></figcaption>
<figcaption class="product-desc2"><h4>name</h4></figcaption>
</figure>
</a>
</div>

How can I prevent switch checkbox elements from overlapping another?

A want to put tree switch on my page. The switch are based on checkbox, and when I try to add more they stay one over the other. this is my code on fiddle: https://jsfiddle.net/kdh8zyo0/
All I want to do is add more two switch one above (not over) other. Like:
Switch 1
Switch 2
Switch 3
The full code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<style>
*, *:before, *:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background: #179b77;
}
.colorful-switch {
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 280px;
height: 120px;
margin-left: -140px;
margin-top: -60px;
border-radius: 50px;
background: #000000;
}
.colorful-switch:before {
content: "";
z-index: -1;
position: absolute;
left: -5px;
top: -5px;
width: 290px;
height: 130px;
border-radius: 55px;
/* COR DA BORDA */
background: #000000;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
}
.colorful-switch:hover:before {
/* COR DA BORDA hover */
background: #13232f;
}
.colorful-switch__checkbox {
z-index: -10;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
.colorful-switch__label {
z-index: 1;
overflow: hidden;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50px;
cursor: pointer;
}
.colorful-switch__bg {
position: absolute;
left: 0;
top: 0;
width: 840px;
height: 100%;
/* background: -webkit-linear-gradient(0deg, #ffffff 0, #ffffff 280px, #ffffff 560px, #ffffff 100%);*/
background: linear-gradient(120deg, #179b77 0, #33FF99 280px, #FF3300 560px, #ff0000 100%);
-webkit-transition: -webkit-transform 0.5s;
transition: -webkit-transform 0.5s;
transition: transform 0.5s;
transition: transform 0.5s, -webkit-transform 0.5s;
-webkit-transform: translate3d(-560px, 0, 0);
transform: translate3d(-560px, 0, 0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__bg {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.colorful-switch__dot {
position: absolute;
left: 204px;
top: 50%;
width: 8px;
height: 8px;
margin-left: -4px;
margin-top: -4px;
border-radius: 50%;
background: #fff;
-webkit-transition: -webkit-transform 0.5s;
transition: -webkit-transform 0.5s;
transition: transform 0.5s;
transition: transform 0.5s, -webkit-transform 0.5s;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__dot {
-webkit-transform: translate3d(-125px, 0, 0);
transform: translate3d(-125px, 0, 0);
}
.colorful-switch__on {
position: absolute;
left: 177px;
top: 35px;
width: 30px;
height: 56px;
-webkit-transition: -webkit-transform 0.5s;
transition: -webkit-transform 0.5s;
transition: transform 0.5s;
transition: transform 0.5s, -webkit-transform 0.5s;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__on {
-webkit-transform: translate3d(-125px, 0, 0);
transform: translate3d(-125px, 0, 0);
}
.colorful-switch__on__inner {
position: absolute;
width: 100%;
height: 100%;
-webkit-transition: -webkit-transform 0.25s 0s cubic-bezier(0.52, -0.96, 0.51, 1.28);
transition: -webkit-transform 0.25s 0s cubic-bezier(0.52, -0.96, 0.51, 1.28);
transition: transform 0.25s 0s cubic-bezier(0.52, -0.96, 0.51, 1.28);
transition: transform 0.25s 0s cubic-bezier(0.52, -0.96, 0.51, 1.28), -webkit-transform 0.25s 0s cubic-bezier(0.52, -0.96, 0.51, 1.28);
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-transform: rotate(45deg) scale(0) translateZ(0);
transform: rotate(45deg) scale(0) translateZ(0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__on__inner {
-webkit-transition: -webkit-transform 0.25s 0.25s cubic-bezier(0.67, -0.16, 0.47, 1.61);
transition: -webkit-transform 0.25s 0.25s cubic-bezier(0.67, -0.16, 0.47, 1.61);
transition: transform 0.25s 0.25s cubic-bezier(0.67, -0.16, 0.47, 1.61);
transition: transform 0.25s 0.25s cubic-bezier(0.67, -0.16, 0.47, 1.61), -webkit-transform 0.25s 0.25s cubic-bezier(0.67, -0.16, 0.47, 1.61);
-webkit-transform: rotate(45deg) scale(1) translateZ(0);
transform: rotate(45deg) scale(1) translateZ(0);
}
.colorful-switch__on__inner:before, .colorful-switch__on__inner:after {
content: "";
position: absolute;
border-radius: 4px;
background: #ffffff;
}
.colorful-switch__on__inner:before {
left: 0;
bottom: 0;
width: 100%;
height: 9px;
}
.colorful-switch__on__inner:after {
right: 0;
top: 0;
width: 9px;
height: 100%;
}
.colorful-switch__off {
position: absolute;
left: 204px;
top: 50%;
width: 64px;
height: 64px;
margin-left: -32px;
margin-top: -32px;
-webkit-transition: -webkit-transform 0.5s;
transition: -webkit-transform 0.5s;
transition: transform 0.5s;
transition: transform 0.5s, -webkit-transform 0.5s;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__off {
-webkit-transform: translate3d(-125px, 0, 0);
transform: translate3d(-125px, 0, 0);
}
.colorful-switch__off:before, .colorful-switch__off:after {
content: "";
position: absolute;
left: 0;
top: 50%;
width: 100%;
height: 8px;
margin-top: -4px;
border-radius: 4px;
background: #ffffff;
-webkit-transition: -webkit-transform 0.25s 0.25s;
transition: -webkit-transform 0.25s 0.25s;
transition: transform 0.25s 0.25s;
transition: transform 0.25s 0.25s, -webkit-transform 0.25s 0.25s;
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__off:before, .colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__off:after {
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
.colorful-switch__off:before {
-webkit-transform: rotate(45deg) scaleX(1) translateZ(0);
transform: rotate(45deg) scaleX(1) translateZ(0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__off:before {
-webkit-transform: rotate(45deg) scaleX(0) translateZ(0);
transform: rotate(45deg) scaleX(0) translateZ(0);
}
.colorful-switch__off:after {
-webkit-transition-timing-function: cubic-bezier(0.67, -0.16, 0.47, 1.61);
transition-timing-function: cubic-bezier(0.67, -0.16, 0.47, 1.61);
-webkit-transform: rotate(-45deg) scaleX(1) translateZ(0);
transform: rotate(-45deg) scaleX(1) translateZ(0);
}
.colorful-switch__checkbox:checked ~ .colorful-switch__label .colorful-switch__off:after {
-webkit-transition-timing-function: ease;
transition-timing-function: ease;
-webkit-transform: rotate(-45deg) scaleX(0) translateZ(0);
transform: rotate(-45deg) scaleX(0) translateZ(0);
}
</style>
<body> <font size="200px">Room</font>
<div class="colorful-switch" >
<input type="checkbox" style=" position: relative;
top: 20px;" class="colorful-switch__checkbox" id="cozinha"/>
<label class="colorful-switch__label" for="cozinha">
<span class="colorful-switch__bg" ></span>
<span class="colorful-switch__dot" ></span>
<span class="colorful-switch__on">
<span class="colorful-switch__on__inner" ></span>
</span>
<span class="colorful-switch__off"></span>
</label>
</div>
</body>
</html>
They stay on top of each other because the placement has been defined in the css. You would need to either remove the:
left: 50%;
top: 50%;
from .colorful-switch and define the values elsewhere or have a different css class for each button.
This would be an example of having seperate css for each buttons position: https://jsfiddle.net/d6LaLgLk/
or: https://jsfiddle.net/d6LaLgLk/1/ which uses px instead of %

Hover effect when hover image

I want to make a hover effect, when hover the image like this:
On the Internet found many similar examples but they all either with jquery or js. I would like to know whether it is possible to do purely with css...
UPDATE: here's a code found, but it is too big :(
.view-content {
height: 330px;
}
h2.view-title {
font-size: 3rem;
font-weight: bold;
color: #7d7a7a;
text-align: center;
text-shadow: 0 0px 0px;
}
.view {
width: 300px;
height: 200px;
margin: 10px;
float: left;
border: 5px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 0px 0px 5px #aaa;
cursor: default;
}
.view .view-mask, .view {
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.view img {
display: block;
position: relative;
}
.view a.view-info {
display: inline-block;
text-decoration: none;
padding:0;
text-align: center;
color: white;
font-size: 1.9rem;
font-weight: 600;
vertical-align: middle;
}
.view-effect .view-mask {
opacity: 0;
overflow:visible;
border:100px solid rgba(0,0,0,0.7);
box-sizing:border-box;
transition: all 0.3s ease-in-out;
}
.view-effect a.view-info {
position:relative;
top:-20px;
opacity: 0;
transition: opacity 0.3s 0s ease-in-out;
}
.view-effect:hover .view-mask {
opacity: 1;
border:100px solid rgba(0,0,0,0.7);
}
.view-effect:hover a.view-info {
opacity:1;
transition-delay: 0.3s;
}
<div class="view view-effect">
<img src="http://storage7.static.itmages.ru/i/16/0708/h_1467979220_8325708_d41d8cd98f.png" height="200" width="300" alt=""> <p></p>
<div class="view-mask">
Show project
</div>
</div>
Checkout below code as what you want or just click on below link :-
https://jsfiddle.net/ananddeepsingh/99bop25r/
HTML
<div class="box"> <img src="http://placehold.it/400x300">
<div class="overbox">
<div class="title overtext"> CSS Script </div>
<div class="tagline overtext"> Animated Text Overlay On Hover </div>
</div>
</div>
CSS
.box {
cursor: pointer;
height: 300px;
position: relative;
overflow: hidden;
width: 400px;
}
.box img {
position: absolute;
left: 0;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box .overbox {
background-color: #304562;
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 360px;
height: 240px;
padding: 130px 20px;
}
.box:hover .overbox {
opacity: 1;
}
.box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box .title {
font-size: 2.5em;
text-transform: uppercase;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.box:hover .title,
.box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.box .tagline {
font-size: 0.8em;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.box:hover .tagline,
.box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
}
Yes you can do that using pure CSS. for that purpose you may use :after pseudo class as,
.img-wrapper {
position:relative;
display:inline-block;
overflow:hidden;
cursor:pointer
}
.img-wrapper .hover-div{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
opacity:0;
display:inline-block;
text-align:center;
background:rgba(0,0,0,0.3);
-webkit-transition: 0.5s ease-in-out;
-moz-transition: 0.5s ease-in-out;
-o-transition: 0.5s ease-in-out;
transition: 0.5s ease-in-out;
-webkit-transform: translateY(100%);
-moz-transform: translateY(100%);
-o-transform: translateY(100%);
-ms-transform: translateY(100%);
transform: translateY(100%);
}
.img-wrapper:hover .hover-div{
top:0;
opacity:1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-o-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
.img-wrapper:hover img {
-webkit-filter:grayscale(1);
-moz-filter:grayscale(1);
filter:grayscale(1);
}
.mybutton{
background:#FFFFFF;
color:#111111;
padding:10px 20px;
border-radius:5px;
display:inline-block;
margin-top:100px;
-webkit-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;
}
.mybutton:hover{
background:#111111;
color:#FFFFFF;
}
<div class="img-wrapper">
<img src="https://unsplash.it/200" >
<div class="hover-div">
<a class="mybutton">My Button</a>
</div>
</div>
Just use ':hover' after the element you want to show the effect on. For example, if you wanted to use it on the header you would create a new css tag called
header:hover{} and then you could put an opactiy of maybe 0.5 to make the object fade on hover. Hope this helps!
Yes it is possible only through HTML and CSS. Below there is an example code:
HTML:
<div class="imagebox">
<div class="transparent"><i class="fa fa-search" aria-hidden="true"></i>
<p>Zoom</p></div>
<img src="images/yourimage.jpg">
</div>
CSS:
.imagebox{
position: relative;
}
.imagebox:hover .transparent{
display: block;
}
.transparent{
background: rgba(0,0,0,0.5);
position: absolute;
height: 100%;
width: 100%;
display: none;
cursor: pointer;
}
.transparent i{
position: absolute;
left: 50%;
top: 30%;
color: #fff;
font-size: 20px;
}
.transparent p{
position: absolute;
left: 45%;
top: 50%;
color: #fff;
font-size: 20px;
}

Effect image on hover with css

I am trying to animated an image on hover. The result i want to have is similar to this one : See here ( scroll to see the image "Our Team" )
So, I want to have a background where i could display some information ( name, links) exactly like in this theme but I can't achieve it.
Here is my code :
<div class="row">
<div class="col-md-6">
<div class="picture">
<div class="photoapropos center-block">
<div class="info">
<img class="img-responsive img-circle" alt="Name" src="<?= $url; ?>"/>
<p>Name</p>
</div>
</div>
</div>
</div>
</div>
And my CSS :
.picture {
display: block;
opacity: 1;
}
.photoapropos{
display: block;
position: relative;
width: 425px;
height: 425px;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.photoapropos:hover .info {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.photoapropos .info {
position: absolute;
background: #FF8C00;
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
Can anyone help me because this feature seemed easy to realise but I don't see what i am missing ?
Thanks.
.picture {
display: block;
opacity: 1;
background:url('http://themes.startbootstrap.com/spectrum-v1.2.0/assets/img/demo-portraits/portrait-4.jpg');
border-radius: 50%;
height: 425px;
width: 425px;
}
.photoapropos{
display: block;
position: relative;
width: 425px;
height: 425px;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.photoapropos:hover .info{
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.photoapropos .info {
position: absolute;
/*background: #FF8C00;*/
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
text-align: center;
background: rgba(82, 219, 235, 0.8);
color: #fff;
}
.photoapropos .info p {
margin-top: 50px;
}
<div class="row">
<div class="col-md-6">
<a class="picture" href="<?= $url; ?>">
<div class="photoapropos center-block">
<div class="info">
<p>Name</p>
</div>
</div>
</a>
</div>
</div>
You need to learn how to copy code. Haha!
Please change classes and other things. You can give credit to that site too.
The effect is coming from CSS scale.
.item {
width: 225px;
height: 225px;
margin: 15px auto;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 15px rgba(244, 245, 247, 0.5);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.item .info {
position: absolute;
background: rgba(82, 219, 235, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 1;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
.about-img-1 {
background-image: url(https://www.gravatar.com/avatar/f44f4e56cd6b6a152f0dcfc8412b7069?s=328&d=identicon&r=PG);
}
.visible-xs {
display: none!important;
}
.img-circle {
border-radius: 50%;
}
.item .info h3 {
color: #f4f5f7;
font-size: 24px;
margin: 0 30px;
padding: 45px 0 0 0;
height: 120px;
}
.item .info p {
color: #f4f5f7;
color: rgba(244, 245, 247, 0.8);
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 14px;
border-top: 1px solid rgba(244, 245, 247, 0.5);
opacity: 0;
-webkit-transition: all 0.4s ease-in-out 0.4s;
-moz-transition: all 0.4s ease-in-out 0.4s;
-o-transition: all 0.4s ease-in-out 0.4s;
-ms-transition: all 0.4s ease-in-out 0.4s;
transition: all 0.4s ease-in-out 0.4s;
}
.item .info .list-inline {
font-size: 18px;
}
.item .info ul {
opacity: 0;
-webkit-transition: all 0.4s ease-in-out 0.4s;
-moz-transition: all 0.4s ease-in-out 0.4s;
-o-transition: all 0.4s ease-in-out 0.4s;
-ms-transition: all 0.4s ease-in-out 0.4s;
transition: all 0.4s ease-in-out 0.4s;
}
.list-inline {
padding-left: 0;
margin-left: -5px;
list-style: none;
}
.item:hover {
box-shadow: none;
}
.item:hover .info {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.item:hover .info ul {
opacity: 1;
}
<div class="item about-img-1">
<div class="info">
<!-- Mobile Fallback Image -->
<img class="img-responsive img-circle visible-xs" src="https://www.gravatar.com/avatar/f44f4e56cd6b6a152f0dcfc8412b7069?s=328&d=identicon&r=PG" alt="">
<!-- Name / Position / Social Links -->
<h3>Kalpesh Singh</h3>
<p>KnowKalpesh.in</p>
<ul class="list-inline">
<li><a class="light-text" href="#"><i class="fa fa-facebook fa-fw"></i></a>
</li>
<li><a class="light-text" href="#"><i class="fa fa-linkedin fa-fw"></i></a>
</li>
<li><a class="light-text" href="#"><i class="fa fa-twitter fa-fw"></i></a>
</li>
</ul>
</div>
</div>
The hover part use box-shadow and scale transform property with CSS transitions.
Here's the result with the website example code and the relevant CSS part.
.item {
width: 225px;
height: 225px;
margin: 15px auto;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 15px rgba(244, 245, 247, 0.5);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.item {
margin: 30px;
}
.about-img-1 {
background-image: url(http://themes.startbootstrap.com/spectrum-v1.2.0/assets/img/demo-portraits/portrait-1.jpg);
}
.img-circle {
border-radius: 50%;
}
.item>a>img, .item>img, .img-responsive, .thumbnail a>img, .thumbnail>img {
display: block;
max-width: 100%;
height: auto;
}
img {
-webkit-backface-visibility: hidden;
width: auto\9;
height: auto;
max-width: 100%;
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic;
}
.item .info h3 {
color: #f4f5f7;
font-size: 24px;
margin: 0 30px;
padding: 45px 0 0 0;
height: 120px;
}
.item .info {
position: absolute;
background: rgba(82, 219, 235, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
.item:hover .info {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.item:hover {
box-shadow: none;
}
Fiddle
Here is an answer for you in Fiddle: https://jsfiddle.net/uhdtv3nv/
.wrapper {
width: 100%;
height: 100%;
background-color: blue;
}
.item {
width: 225px;
height: 225px;
margin: 15px auto;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 15px rgba(244, 245, 247, 0.5);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
background-image: url('http://iconshow.me/media/images/ui/ios7-icons/png/512/person_1.png');
}
.item:hover {
box-shadow: none;
}
.item:hover .info {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.info {
position: absolute;
background: rgba(82, 219, 235, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
.item h3 {
padding: 80px 70px;
}
<div class="wrapper">
<div class="item about-img-1">
<div class="info">
<h3>Some text</h3>
</div>
</div>
</div>