How can I delay a :hover effect in CSS?

You can use transitions to delay the :hover effect you want, if the effect is CSS-based. For example div{ transition: 0s background-color; } div:hover{ background-color:red; transition-delay:1s; } this will delay applying the the hover effects (background-color in this case) for one second. Demo of delay on both hover on and off: div{ display:inline-block; padding:5px; margin:10px; … Read more

CSS: Hover one element, effect for multiple elements?

You don’t need JavaScript for this. Some CSS would do it. Here is an example: <html> <style type=”text/css”> .section { background:#ccc; } .layer { background:#ddd; } .section:hover img { border:2px solid #333; } .section:hover .layer { border:2px solid #F90; } </style> </head> <body> <div class=”section”> <img src=”https://stackoverflow.com/questions/1462360/myImage.jpg” /> <div class=”layer”>Lorem Ipsum</div> </div> </body> </html>

How to show text on image when hovering?

It’s simple. Wrap the image and the “appear on hover” description in a div with the same dimensions of the image. Then, with some CSS, order the description to appear while hovering that div. /* quick reset */ * { margin: 0; padding: 0; border: 0; } /* relevant styles */ .img__wrap { position: relative; … Read more

How to use ‘hover’ in CSS

If you want the underline to be present while the mouse hovers over the link, then: a:hover {text-decoration: underline; } is sufficient, however you can also use a class-name of ‘hover’ if you wish, and the following would be equally applicable: a.hover:hover {text-decoration: underline; } Incidentally it may be worth pointing out that the class … Read more

Is there any way to hover over one element and affect a different element? [duplicate]

The only way to do this with CSS is if the element to affect is either a descendent or an adjacent sibling. In the case of a descendent: #parent_element:hover #child_element, /* or */ #parent_element:hover > #child_element { opacity: 0.3; } Which will apply to elements such as: <div id=”parent_element”> <div id=”child_element”>Content</div> </div> For adjacent siblings: … Read more

How to change CSS property using JavaScript

You can use style property for this. For example, if you want to change border – document.elm.style.border = “3px solid #FF0000”; similarly for color – document.getElementById(“p2″).style.color=”blue”; Best thing is you define a class and do this – document.getElementById(“p2”).className = “classname”; (Cross Browser artifacts must be considered accordingly).

Changing image on hover with CSS/HTML

Another option is to use JS: <img src=”https://stackoverflow.com/questions/18813299/LibraryTransparent.png” onmouseover=”this.src=”LibraryHoverTrans.png”;” onmouseout=”this.src=”https://stackoverflow.com/questions/18813299/LibraryTransparent.png”;” />

CSS transition effect makes image blurry / moves image 1px, in Chrome?

2020 update If you have issues with blurry images, be sure to check answers from below as well, especially the image-rendering CSS property. For best practice accessibility and SEO wise you could replace the background image with an <img> tag using object-fit CSS property. Original answer Try this in your CSS: .your-class-name { /* … … Read more