CSS hover effect for PNG images [closed] - html

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I need a CSS hover effect for a png image without using two images. Bascially when a user hovers over the png image it would show a glow or other effect without highlighting the whole box but just the png image. I've tried using masking effect but that requires a second image and i have multiple object that don't have same shape and I want to use one css effect for all.
HTML
<div class="brighten pic">
<img src="imgs/bookcase-02.png">
</div>
CSS
/*DARKEN*/
.brighten img {
display: inline-block;
margin: 100px auto;
-webkit-filter: brightness(100%);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
.brighten img:hover {
-webkit-filter: brightness(120%);
}

Try This:
.brighten img {
opacity: 0.3;
}
.brighten img:hover {
opacity: 1;
}

You want to do something like this in JQuery. Be sure you are calling the JQuery library. I call mine from google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" type="text/javascript"></script>
THEN you want to do something like this:
<script type="text/javascript">
$(document).ready(function () {
$(".YourImageName").mouseenter(function () {
$(this).css('box-shadow', '0 0 2px #888');
});
$(".YourImageName").mouseleave(function () {
$(this).css('box-shadow', 'none');
});
}
</script>
This gives you a shadow around the edges and you can change the color or change the css entirely to better suit your needs.
It would be a little more helpful in the future if you provided us what code you currently have so we have a better understanding of what it is you want. This code is taken from live web use and changed to work for your scenario. You will have to change the class names to yours. Hope this helps!

Related

Disable CSS Animation run on page load (No JS, Only HTML & CSS)

I got a problem, I made a check mark CSS animation on my website, but they start on page load, and it shouldn't, it should only trigger on hovering / unhovering.
And the text need to collapse like (...) when the price goes above the description
All the code is available here: https://github.com/Douwdy/Projet-3
And you can get a preview here: https://douwdy.github.io/Projet-3/menu-1.html
Someone can help me to fix that ?
No Js Suggestion please
For CSS animations on page load your, I had a look at this and I would use transition & transform instead of animation
So if you remove the animations (check-box__in & check-box__out) in your css and replace with transitions below:
.menu-selector-box:hover .menu-selector-box__validator {
transition: transform 1s ease-out;
transform: translateX(-60px);
}
.menu-selector-box__validator {
transition: transform 1s ease-out;
}
.menu-selector-box-text__price {
transition: transform 1s ease-out;
}
.menu-selector-box:hover .menu-selector-box-text__price {
transition: transform 1s ease-out;
transform: translateX(-60px);
}
For the text issue I would suggest setting a width on menu-selector-box-text (I used 275px) and then on hover reduce the width (I used 225px), you can use the same transitions as above when reducing the width (transition: width 1s ease-out;)
Then the styles below need to be applied to the <h5> and the <p> tags.
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

css move elements smoothly

Trying to make userface more userfriendly i want to implement following:
I have a table with some alert above it. Take a look at this example
When I close alert table 'jumps' to the top. I want it to slide smoothly. I want to use pure css. I've read about transition and animation but i think that's not what i need, or maybe i am wrong.
Any ideas? Thanks in advance!
K, so you can do it with pure css. Bootstrap removes the in class from the alert at the beginning of the fade out. We can use that to apply css to the alert before it's removed from the page.
.fade {
max-height: 400px;
-webkit-transition: .3s;
-ms-transition: .3s;
transition: .3s;
}
.fade:not(.in) {
max-height: 0;
}
See it in action: http://jsfiddle.net/McHUc/92/

Adding CSS ease-in and ease-out transition for changing images

I am trying to add a simple ease-in and ease-out effect when you hover over a logo. I know there are posts about this. I've tried many different combinations of CSS, but can't seem to get it to work.
I've successfully changed the logo color by changing the content upon hover with this CSS code:
#dealertrackr-image.et_pb_image:hover {
content: url('image url');
}
When it is hovered over, the logo changes from the black and white state to colored state. I now want this to have a 1s ease-in and ease-out on hover and release of hover. Nothing that I tried worked.
http://www.nationalgalactic.com/divisions/
If all you were hoping for was grayscale, you may also be interested in just loading in the full color image and using a CSS filter to desaturate / resaturate on hover.
This combined with CSS transitions will create a nice little fade:
img {
-webkit-filter: grayscale(100%);
filter: gray; filter: grayscale(100%);
filter: url(desaturate.svg#greyscale);
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
transition: all .25s ease;
}
img:hover {
-webkit-filter: grayscale(0%);
filter: none;
}
*edit
This is a pure CSS solution, but is not fully supported in Android Jellybean, and Internet Explorer. If full browser support is important to you, please see isherwood's answer on this same post. For full support, your solutions are limited to stacked images or javascript.
The only way to do it with images is to stack elements and transition the opacity of the top layer. Browsers don't do image-to-image transitions.
Something like this, where the anchor has a background image:
a {
display: inline-block;
background: url(http://lorempixel.com/400/150/nature) left top no-repeat;
}
a img {
transition: opacity 1s;
}
a:hover img {
opacity: 0;
}
<a href="#">
<img src="http://lorempixel.com/400/150/nature/2" alt="">
</a>
Here's a demo with your code and images.

CSS custom button slide transition?

Alright Google isn't helping me out much here.
The aim of the game is to have a button, which is a custom png, and upon mouse rollover it 'slides upwards', remaining in the same spot but transitioning to the rollover by means of sliding.
Preferably I'd like to get this sorted using CSS3, the page already has a bit of an OTT fest of JQuery.
Currently I've only managed to get it to slide from the left side. Downwards is fine too.
Code is about as simple as it comes, the HTML looks like this (Just a basic DIV):
<div id="Abutton"><a draggable="false" title="A button n' stuff"></a></div>
The CSS:
#Abutton a {
background: url(mediafolder/Abutton.png) no-repeat 0% 0px;
display: block;
height: 32px;
width: 86px;
cursor: pointer;
transition: background .25s ease-in-out;
-moz-transition: background .25s ease-in-out;
-webkit-transition: background .25s ease-in-out;
}
#Abutton a:hover {
background-position: -86px 0%;
}
(Plus a further # for the positioning and size etc..)
If it makes for any complications the button is also tied to a JQuery file that upon clicking, smooth scrolls to a different point in the page (Props to the awesome chap that helped me out with that last night!).
Thanks in advance!
I think what you're asking is a slot machine display type feel?
Just use an image sprite, which you pretty much already are trying to do, and put a css animation on it, and it will look what you want (which i think is what you want?) Best of luck
.animate {
-webkit-transition: all 0.250s -in-out;
-moz-transition: all 0.250s ease-in-out;
-o-transition: all 0.250s ease-in-out;
transition: all 0.250s ease-in-out;
}

what is this kind of css animation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
In this link,
There is a panel at the right hand side with class name .list-panel, the original width is 600px.
If you open the developer tools and change the width from 600px to ,say 900px and you will see there is a sliding effect. This is quite different from the normal behaviour.
How does it work actually? It looks like there is something monitoring the css style changes at all time and applies the changes with animation.
Thanks.
It's just your average transition, pretty cool:
.list-panel {
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-ms-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .5s ease;
}