How to apply effect just to background image and not text - html

I'm searching a way to make an css effect but with exception of not applying the effect to the letters and the buttons (Only to the image), so I need create a rule in css. I can't change the order of the things.
With my code, I get something like this.
This is my code, like you can see I applied some effect in css and this is getting applied to all. I only need it for the image.
.myimage01 {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}
.myimage01:hover {
-webkit-transform: scale(1.3);
transform: scale(1.3);
}
<li id="armonioso-text-2" class="widget widget_armonioso_text">
<div class="armonioso-textwidget-wrapper armonioso-textwidget-no-paddings">
<!-- Here I'm currently Applying the efect -->
<div class="armonioso-textwidget myimage01" data-style="background-image: url(http:www.myurl.com/image.jpg);padding: 40px 30px ;color: #ffffff;text-align: center;">
<h5>hello world</h5>
<h3>Here how works</h3>
<p>Take a look of new things
<p><a class="btn alt" href="about/index.html" target="_self">About me</a>
</div>
</div>
<!-- Here I'm currently Applying the efect -->
</li>
When I apply the effect apply the effect to the letters (h5, h3, p and the button with btn class)
I don't want the effect for them, only for the background-image.
How can I do?

for transition backgrounds use the property background-size, and use background-position to adjust as fits you better
body {
margin: 0
}
.myimage01 {
background-size: 100%;
background-position:center center;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
background-image: url(http://lorempixel.com/1600/900);
padding: 40px 30px;
color: #ffffff;
text-align: center;
}
.myimage01:hover {
background-size: 130%;
}
<li id="armonioso-text-2" class="widget widget_armonioso_text">
<div class="armonioso-textwidget-wrapper armonioso-textwidget-no-paddings">
<!-- Here I'm currently Applying the efect -->
<div class="armonioso-textwidget myimage01">
<h5>hello world</h5>
<h3>Here how works</h3>
<p>Take a look of new things
<p><a class="btn alt" href="about/index.html" target="_self">About me</a>
</div>
</div>
<!-- Here I'm currently Applying the efect -->
</li>

Use background-size for transition:
div {
background-image: url(http://lorempixel.com/400/200/sports/1/);
background-size: 100%;
background-repeat:no-repeat;
background-position:50% 50%;
width:400px;
height:200px;
transition: background-size 200ms linear;
text-align:center;
line-height:200px;
}
div:hover {
background-size: 120%;
}
<div>
Some text
</div>

try to transform the background-size property instead of scaling the whole container.

You can apply transform on background-size, background-position to get the effect on the background image.
.myimage01 {
background-size:100%;
background-position:0px 0px;
-webkit-transform: all;
transform: all;
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}
.myimage01:hover {
background-size:140%;
background-position:-50px -50px;
-webkit-transform: all;
transform: all;
}
<li id="armonioso-text-2" class="widget widget_armonioso_text">
<div class="armonioso-textwidget-wrapper armonioso-textwidget-no-paddings">
<!-- Here I'm currently Applying the efect -->
<div class="armonioso-textwidget myimage01" style="background-image: url(http://dummyimage.com/600x200/000/fff);padding: 40px 30px ;color: #ffffff;text-align: center;">
<h5>hello world</h5>
<h3>Here how works</h3>
<p>Take a look of new things
<p><a class="btn alt" href="about/index.html" target="_self">About me</a>
</div>
</div>
<!-- Here I'm currently Applying the efect -->
</li>

Related

Css Position Absolute on Hover need to move down next element

I'm in front of a problem that I don't succeed to resolve from couple of hours.
I have two lines of "buttons", and when you hover a button a text need to be displayed ( full width ) under the line where was the button.
My problem is that, this part is ok, but when the text is displayed he is hiding the next line of "buttons", I would like for this line to be "pushed" by the hover animation that display the text under the first line.
Can someone help me to do that and to explain to me why it's not working actually ? I think the absolute tag on the CSS is ruining my plan.
body {
font-family: helvetica;
font-size: 18px;
text-align: center;
}
.column1 {
width: 100%;
}
.column2 {
width: 100%;
}
div{
float:left;
}
.accordion {
display: inline-block;
text-align: left;
margin: 1%;
width: 20%;
}
.accordion:hover .accordion-content {
max-height: 300px;
}
.accordion-content {
-webkit-transition: max-height 1s;
-moz-transition: max-height 1s;
-ms-transition: max-height 1s;
-o-transition: max-height 1s;
transition: max-height 1s;
background: #e5feff;
overflow: hidden;
max-height: 0;
position:absolute;
left:0;
}
.accordion-inner {
padding: 0 15px;
}
.accordion-toggle {
-webkit-transition: background .1s linear;
-moz-transition: background .1s linear;
-ms-transition: background .1s linear;
-o-transition: background .1s linear;
transition: background .1s linear;
background: #00b8c9;
border-radius: 3px;
color: #ffffff;
display: block;
font-size: 30px;
margin: 0 0 10px;
padding: 10px;
text-align: centre;
text-decoration: none;
}
.accordion-toggle:hover {
background: #00727d;
}
<div class="column1">
<div class="accordion">
<a class="accordion-toggle">Hover 1</a>
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
<div class="accordion">
<a class="accordion-toggle">Hover 2</a>
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
<div class="accordion">
<a class="accordion-toggle">Hover 3</a>
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
</div>
<div class="column2">
<div class="accordion">
<a class="accordion-toggle">Hover 4</a>
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
<div class="accordion">
<a class="accordion-toggle">Hover 5</a>
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
<div class="accordion">
Hover 6
<div class="accordion-content">
<div class="accordion-inner">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
</div>
The simplest solution is that you have to move divs outside .accordion. Like that.
body {
font-family: helvetica;
font-size: 18px;
text-align: center;
}
.column1 {
width: 100%;
}
.column2 {
width: 100%;
}
div{
float:left;
}
.accordion-style {
display: inline-block;
text-align: left;
margin: 1%;
width: 22%;
}
.accordion1:hover ~ .accordion-content1, .accordion2:hover ~ .accordion-content2, .accordion3:hover ~ .accordion-content3, .accordion4:hover ~ .accordion-content4, .accordion5:hover ~ .accordion-content5, .accordion6:hover ~ .accordion-content6 {
max-height: 300px;
}
.accordion-content-style {
-webkit-transition: max-height 1s;
-moz-transition: max-height 1s;
-ms-transition: max-height 1s;
-o-transition: max-height 1s;
transition: max-height 1s;
background: #e5feff;
overflow: hidden;
max-height: 0;
left:0;
}
.accordion-inner {
padding: 0 15px;
}
.accordion-toggle {
-webkit-transition: background .1s linear;
-moz-transition: background .1s linear;
-ms-transition: background .1s linear;
-o-transition: background .1s linear;
transition: background .1s linear;
background: #00b8c9;
border-radius: 3px;
color: #ffffff;
display: block;
font-size: 30px;
margin: 0 0 10px;
padding: 10px;
text-align: centre;
text-decoration: none;
}
.accordion-toggle:hover {
background: #00727d;
}
<div class="column1">
<div class="accordion1 accordion-style">
<a class="accordion-toggle">Hover 1</a>
</div>
<div class="accordion2 accordion-style">
<a class="accordion-toggle">Hover 2</a>
</div>
<div class="accordion3 accordion-style">
<a class="accordion-toggle">Hover 3</a>
</div>
<div class="accordion-content1 accordion-content-style">
<div class="accordion-inner1">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
<div class="accordion-content2 accordion-content-style">
<div class="accordion-inner2">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
<div class="accordion-content3 accordion-content-style">
<div class="accordion-inner3">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
<div class="column2">
<div class="accordion4 accordion-style">
<a class="accordion-toggle">Hover 4</a>
</div>
<div class="accordion5 accordion-style">
<a class="accordion-toggle">Hover 5</a>
</div>
<div class="accordion6 accordion-style">
Hover 6
</div>
<div class="accordion-content4 accordion-content-style">
<div class="accordion-inner4">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
<div class="accordion-content5 accordion-content-style">
<div class="accordion-inner5">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
<div class="accordion-content6 accordion-content-style">
<div class="accordion-inner6">
<p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
<p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p>
</div>
</div>
</div>
Try changing this block. The position:relative will make the div actually be between the two lines of buttons. Then, set the width that u want that text to be. You can't use 100%, but, if as you said you want to get it full width, try using 100vw, which is equivalent to the full viewport width value.
Replace with this and it should work as intended:
.accordion-content {
-webkit-transition: max-height 1s;
-moz-transition: max-height 1s;
-ms-transition: max-height 1s;
-o-transition: max-height 1s;
transition: max-height 1s;
background: #e5feff;
overflow: hidden;
max-height: 0;
position:absolute;
left:0;
}
You could remove position: absolute; from .accordion-content and add
display: flex; to .column1 and .column2
Now, I don't know if it'll be a problem to you, but the limitation of this solution is that it will contain the text that appear under to the size of your buttons.
Hope that fixes your problem

CSS transitions on hover not working in Safari, even with correct prefixes [duplicate]

I'm having odd behavior where circular pictures are changing to square on desktop and mobile. This only seems to be happening on safari, and it only happens when I add a CSS transition. Here's the website:
https://shmoss.github.io/Gibbs-Lab/people.html
If you view on mobile and click on a photo, it will change to a square. Here's the code:
<div class="py-5 text-center text-info background-info" style="">
<div class="container" id="people-container">
<div id="parent" class="row">
<!-- Lead Scientists -->
<div class="col-6 col-md-3 p-4 holly-gibbs lead-scientist">
<div class="img-holder">
<a style='color:none'href="holly-gibbs.html"><img class="img-fluid d-block mx-auto" src="bio_img/holly_gibbs_bio_new.png" alt="Card image cap" width="200">
</a>
</div>
<div class="bio-holder">
<a style='color:none'href="holly-gibbs.html">
<h4 class="people_name"> <b>Holly Gibbs</b> </h4>
<p class="mb-0">PROFESSOR AND DIRECTOR OF GLUE LAB</p>
</a>
</div>
</div>
<div class="col-6 col-md-3 p-4 lead-scientist">
<div class="img-holder">
<a style='color:none'href="tyler-lark.html"><img class="img-fluid d-block mx-auto " src="bio_img/tyler_lark_bio.png" alt="Card image cap" width="200">
</a>
</div>
<div class="bio-holder">
<a style='color:none'href="tyler-lark.html">
<h4 class="people_name"> <b>Tyler Lark</b> </h4>
<p class="mb-0">LEAD SCIENTIST</p>
</a>
</div>
</div>
</div>
</div>
/* ------------------------------People Page ------------------------------*/
/* container for people photos */
#people-container {
padding-top:10px;
}
/* Bio photo */
.img-holder {
max-width: 200px;
max-height: 200px;
overflow: hidden !important;
margin:0 auto
}
/* Bio info container (name, title) */
.bio-holder {
padding-top:10px;
}
/* Bio title */
.mb-0 {
color:#004869 !important;
font-size:14px;
font-weight:500 !important;
text-transform: uppercase
}
/* Bio image container */
.img-holder {
box-shadow: 0px 3px 15px rgba(0,0,0,0.2);
border-radius:50%
}
/* Scaling bio image on hover */
/* THIS CAUSES THE ISSUE! */
.img-fluid.d-block.mx-auto:hover {
-webkit-transform: scale(1.1);
-webkit-transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
transition: all 0.125s ease-in-out 0s;
}
.img-fluid.d-block.mb-3.mx-auto:focus {
-webkit-transform: scale(1.1);
-webkit-transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
transition: all 0.125s ease-in-out 0s;
}
I can't seem to figure out what's going on, maybe conflicting CSS somewhere?
I can reproduce, here is a minimal example, (please next time try to make yours as minimal)
.round {
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
}
.inner {
transition: all 1s;
background: radial-gradient(red, green);
height: 100%;
cursor: pointer;
}
.inner:hover {
transform: scale(2);
}
<div class=round >
<div class=inner ></div>
</div>
This is a Safari bug, your code is fine [should work], and you should report the issue at https://bugs.webkit.org/.
The problem seems to affect only the software rendering, if we force using the GPU rendering, e.g by applying a 0px translateZ on the container, it works as expected:
.round {
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
transform: translateZ(0px); /* force GPU rendering */
}
.inner {
transition: all 1s;
background: radial-gradient(red, green);
height: 100%;
cursor: pointer;
}
.inner:hover {
transform: scale(2);
}
<div class=round >
<div class=inner ></div>
</div>
So in your code you'd add this on the .img-holder rule.
However note that you probably don't need the prefixes for these properties anymore, and that even if you do need them, you should always add the unprefixed ones too, at the end. Currently your code only has -webkit-transform set, not the unprefixed one. This particular case works, but on some property you'll get different behaviors when the prefixed version is being chosen over the unprefixed one.
I think you need to clear your cache cos I can't notice it here
Tried on a OnePlus with both Chrome and Mozilla, it seems exactly like on desktop.
CSS has a habit of bugging out, try to clear cache line Nasiru stated or try a different browser just for testing

CSS transition not working on Safari even with prefixes [duplicate]

I'm having odd behavior where circular pictures are changing to square on desktop and mobile. This only seems to be happening on safari, and it only happens when I add a CSS transition. Here's the website:
https://shmoss.github.io/Gibbs-Lab/people.html
If you view on mobile and click on a photo, it will change to a square. Here's the code:
<div class="py-5 text-center text-info background-info" style="">
<div class="container" id="people-container">
<div id="parent" class="row">
<!-- Lead Scientists -->
<div class="col-6 col-md-3 p-4 holly-gibbs lead-scientist">
<div class="img-holder">
<a style='color:none'href="holly-gibbs.html"><img class="img-fluid d-block mx-auto" src="bio_img/holly_gibbs_bio_new.png" alt="Card image cap" width="200">
</a>
</div>
<div class="bio-holder">
<a style='color:none'href="holly-gibbs.html">
<h4 class="people_name"> <b>Holly Gibbs</b> </h4>
<p class="mb-0">PROFESSOR AND DIRECTOR OF GLUE LAB</p>
</a>
</div>
</div>
<div class="col-6 col-md-3 p-4 lead-scientist">
<div class="img-holder">
<a style='color:none'href="tyler-lark.html"><img class="img-fluid d-block mx-auto " src="bio_img/tyler_lark_bio.png" alt="Card image cap" width="200">
</a>
</div>
<div class="bio-holder">
<a style='color:none'href="tyler-lark.html">
<h4 class="people_name"> <b>Tyler Lark</b> </h4>
<p class="mb-0">LEAD SCIENTIST</p>
</a>
</div>
</div>
</div>
</div>
/* ------------------------------People Page ------------------------------*/
/* container for people photos */
#people-container {
padding-top:10px;
}
/* Bio photo */
.img-holder {
max-width: 200px;
max-height: 200px;
overflow: hidden !important;
margin:0 auto
}
/* Bio info container (name, title) */
.bio-holder {
padding-top:10px;
}
/* Bio title */
.mb-0 {
color:#004869 !important;
font-size:14px;
font-weight:500 !important;
text-transform: uppercase
}
/* Bio image container */
.img-holder {
box-shadow: 0px 3px 15px rgba(0,0,0,0.2);
border-radius:50%
}
/* Scaling bio image on hover */
/* THIS CAUSES THE ISSUE! */
.img-fluid.d-block.mx-auto:hover {
-webkit-transform: scale(1.1);
-webkit-transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
transition: all 0.125s ease-in-out 0s;
}
.img-fluid.d-block.mb-3.mx-auto:focus {
-webkit-transform: scale(1.1);
-webkit-transition: all 0.125s ease-in-out 0s;
-moz-transition: all 0.125s ease-in-out 0s;
-ms-transition: all 0.125s ease-in-out 0s;
-o-transition: all 0.125s ease-in-out 0s;
transition: all 0.125s ease-in-out 0s;
}
I can't seem to figure out what's going on, maybe conflicting CSS somewhere?
I can reproduce, here is a minimal example, (please next time try to make yours as minimal)
.round {
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
}
.inner {
transition: all 1s;
background: radial-gradient(red, green);
height: 100%;
cursor: pointer;
}
.inner:hover {
transform: scale(2);
}
<div class=round >
<div class=inner ></div>
</div>
This is a Safari bug, your code is fine [should work], and you should report the issue at https://bugs.webkit.org/.
The problem seems to affect only the software rendering, if we force using the GPU rendering, e.g by applying a 0px translateZ on the container, it works as expected:
.round {
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
transform: translateZ(0px); /* force GPU rendering */
}
.inner {
transition: all 1s;
background: radial-gradient(red, green);
height: 100%;
cursor: pointer;
}
.inner:hover {
transform: scale(2);
}
<div class=round >
<div class=inner ></div>
</div>
So in your code you'd add this on the .img-holder rule.
However note that you probably don't need the prefixes for these properties anymore, and that even if you do need them, you should always add the unprefixed ones too, at the end. Currently your code only has -webkit-transform set, not the unprefixed one. This particular case works, but on some property you'll get different behaviors when the prefixed version is being chosen over the unprefixed one.
I think you need to clear your cache cos I can't notice it here
Tried on a OnePlus with both Chrome and Mozilla, it seems exactly like on desktop.
CSS has a habit of bugging out, try to clear cache line Nasiru stated or try a different browser just for testing

how do i use hovering slide images on notepad++?

I started a project in Notepad++ and I would like to create a slider on hover while using CSS. The problem is that I do not know if my picture (which I wanted to create a slider with) needs to be separated in 2 images or 1 merged picture. I also don't know if translate3d works in notepad++.
Here's what my HTML looks like:
<div class="college">
<img src="image.png" />
and here's my current CSS:
body {
background: url("anotherimage.png") 33em 0% fixed no-repeat;
background-color: rgb(0,85,170);
}
.college {
margin-left: 100px;
margin-top: 325px;
overflow: hidden;
}
.college img {
}
.college img:hover {
}
edit
hello again, after we've found out about my problem with hovering sliding images, i managed to make my own ligns of codes but now im stuck into another problem, while i was douing my code my images were going behind the background which i liked it very much but when i finished all of it, it stopped douing it ,i've tried using overflow: hidden and postion: absolute but i don't really get how it works especially since when i search what their fonction does. and i thought i was douing right but it seems it doesn't change anything at all,
so i would like to know how i manage to make my moving pictures to go out of the screen/ hide inside the background.
here what my css looks like
` .college .image {
margin-left: 100px;
margin-top: 475px;
position: absolute
}
.college .imagesecond {
transform: translate(0px,500px);
transition: transform 1s ease-in-out 0.2s;
border-radius: 8px;
overflow: hidden
}
.college:hover > .imagesecond{
transform: translate(0,-200px);
}
.lycee .image {
margin-left: 700px;
margin-top: 500px;
position: absolute
}
.lycee .imagefourth{
transform: translate(0px,500px);
transition: transform 0.9s ease-in-out 0.2s;
border-radius: 8px;
overflow: hidden
}
.lycee:hover > .imagefourth{
transform: translate(0,-500px);
}
.formation .image{
margin-left: 1250px;
margin-top:510px;
overflow: hidden;
}
.formation .imagesixth{
transform: translate(0px,100px);
transition: transform 1s ease-in-out 0.2s;
border-radius: 8px;
overflow: hidden
}
.formation:hover > .imagesixth{
transform: translate(0 ,-75
0px);`
here is my html
<div class="saintemarie">
<a href="">
<div class="college">
<img class="image imagefirst" src="choixcollege.png" />
<img class="image imagesecond" src="pepepls.gif"/>
</div>
</a>
<a href="lyceesaintemarie.html">
<div class="lycee">
<img class="image imagethird" src="choixlyceepro.png" />
<img class="image imagefourth" src="pepepls.gif" />
</div>
</a>
<a href="c&fsaintemarie.html">
<div class="formation">
<img class="image imagefifth" src="choix
centre&formation.png" />
<img class="image imagesixth" src="pepepls.gif" />
</div>
</div>
</a
I'm not fully sure what you're asking but is this what you're wanting? If so you're more interested in transitions or animations, hover within the blue border
https://jsfiddle.net/gevfeqk9/24/
.college {
margin: auto;
overflow: hidden;
border: 1px solid blue;
}
.college .image-1{
transform: translate(-280px,0);
transition: transform 1s ease-in-out 0s;
}
.college .image-2{
transform: translate(-560px,0);
transition: transform 1s ease-in-out 0s;
}
.college:hover .image-1,.college:hover .image-2{
transform: translate(0,0);
}

Disable hover on specific div

When I hover over my #icon div, an image appears. When I remove the mouse from #icon the image disappears.
THE PROBLEM
If I hover over the space where the image will appear if I hover over #icon, the image appears. I've tried anything, so I really hope you can help.
I need to remove all hover effects on my #image-divs
HTML
<div id="box">
<div id="icons1">
<div id="image1"></div>
</div>
<div id="icons2">
<div id="image2"></div>
</div>
<div id="icons3">
<div id="image3"></div>
</div>
<div id="icons4">
<div id="image4"></div>
</div>
</div>
CSS EXAMPLE
#box #icons1 #billede1 {
height: 450px;
width: 1000px;
margin-left: -186%;
margin-top: 150px;
background-image: url(../html_css/billeder/1.jpeg);
background-position: center;
background-size: cover;
opacity: 0.0;
transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
}
Use pointer-events:none
div{pointer-events:none}
div:hover{color:red;}
<div>Hover over me</div>
best way is to use pointer-events:none;
#image-divs{
pointer-events:none;
}
Notice that you to specify every hover for every div while you are using id's, you need to specify the hover effect for every div, now you should use this :
#image1{
display:none;
}
#icons1:hover #image1
display:block;
}
this means, whenever you hover the icon1, image1 will be displayed, and so.
you can also try the opactiy:0; and opacity:1;