I cant get this transition working in IE or Firefox, It looks fine in Safari and Chrome.
The opacity shows but is instant.
To me the below CSS looks right and I can't see any reason that it would work in either IE or firefox.
I've tried this using -ms-transition and it yields the same results, but the site uses CSS3 anyway so shouldn't need the -ms- anyway from what I've read.
Any light that can be shed would be greatly appreciated!
Ben
CSS:
.XMABAN {
height: 153px;
width: 230px;
background-color:rgb(127,0,25);
padding: 0;
vertical-align: top;
}
.XMABAN a {
height: 153px;
width: 230px;
text-decoration:none;
}
.XMABAN a:hover {
text-decoration:none;
}
.XMABAN img {
opacity: 1;
transition: opacity 0.70s ease-in-out;
-moz-transition: opacity 0.70s ease-in-out;
-webkit-transition: opacity 0.70s ease-in-out;
-o-transition: opacity 0.70s ease-in-out;
}
.XMABAN a:hover img {
opacity: 0.30;
transition: opacity 0.25s ease-in-out;
-moz-transition: opacity 0.25s ease-in-out;
-webkit-transition: opacity 0.25s ease-in-out;
-o-transition: opacity 0.25s ease-in-out;
}
.XMABAN span {
position: relative;
left: 0%;
top: -62%;
font-weight:bold;
font-size:20pt;
color:#404040;
transition: color 0.70s ease-in-out;
-moz-transition: color 0.70s ease-in-out;
-webkit-transition: color 0.70s ease-in-out;
-o-transition: color 0.70s ease-in-out;
}
.XMABAN a:hover span {
color:#FFF0F5;
transition: color 0.25s ease-in-out;
-moz-transition: color 0.25s ease-in-out;
-webkit-transition: color 0.25s ease-in-out;
-o-transition: color 0.25s ease-in-out;
}
HTML:
<tr>
<td style="width: 33%;">
<div class="XMABAN" style="margin: 10px 0px 5px 0px;">
<a class="DSPI" href="online.asp">
<img src="../images/PRM_220.jpg">
<span>TEXT</span>
</a>
</div>
</td>
</tr>
CSS Transitions are not supported in IE9 or lower. They are supported in IE10, however, and the CSS you've included does work correctly in IE10.
I can only assume you're using IE10 with IE9 standards to test this, which is why the transition isn't working. To change this, simply set IE's Document Mode to Standards:
It's also worth noting that you should always include vendor prefixing before the intended CSS property. Specifying transition before -webkit-transition, for instance, will tell WebKit-based browsers to use the prefixed version instead of the actual version, and there may be differences in how each are handled. Change your CSS to:
-moz-transition: ...;
-webkit-transition: ...;
-o-transition: ...;
transition: ...;
Related
Basically I've an HTML 5 range element, which works as my app videos tracker.
Before mentioning my problem here is CSS stylesheet:
.vidskb_r::-moz-range-thumb,.vidskb_r::-webkit-slider-thumb{
height: 0px;
width: 0px;
appearance:none;
-moz-appearance:none;
-moz-transition: height .2s ease-in-out, width .2s ease-in-out;
-webkit-appearance:none;
transition: height .2s ease-in-out, width .2s ease-in-out;
-webkit-transition: height .2s ease-in-out, width .2s ease-in-out;
background-color:rgb(213,90,0);
}
input[type=range]:hover::-webkit-slider-thumb,input[type=range]:hover::-moz-range-thumb{
height:12px;
width:12px;
}
Now .vidskb_r::-moz-range-thumb,.vlrange::-moz-range-thumb, doesn't let me create my custom range thumb as long as I create a new specific class for my thumb:
.vidskb_r::-moz-range-thumb{
height: 0px;
width: 0px;
appearance:none;
-moz-appearance:none;
border-radius:50px;
background-color:rgb(213,90,0);
-moz-transition: height .2s ease-in-out, width .2s ease-in-out;
transition: height .2s ease-in-out, width .2s ease-in-out;
}
Reason: I don't know.
And Also the transition doesn't works too, when I hover over the range, it just pop up and not with animation.
Thanks in advance!
I have a hovering effect on an image. If you mouseover it and stay there with the mouse, the transition will be execute with its given duration.
I have also done the correct transition when you leave the spot.
Now, i want that the hover transition starts with the given duration, no matter if you just hovered over the image for a quick 1millisecond.
Is this only possible with javascript?
.example { position: absolute;
left: 0;
height:320px;
bottom: 0;
width: 100%;
background: #000;
background-color: rgba(255, 255, 255, 0.4);
opacity:0;
-webkit-transition: background-color 2s ease-out;
-moz-transition: background-color 2s ease-out;
-o-transition: background-color 2s ease-out;
-ms-transition: background-color 2s ease-out;
transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
text-align: center;
line-height: 299px;
text-decoration: none;
color: #000000;
font-size:30pt;
}
.image:hover .example { background-color: rgba(255, 255, 255, 0.4);
-webkit-transition: background-color 0.5s ease-in-out;
-moz-transition: background-color 0.5s ease-in-out;
-o-transition: background-color 0.5s ease-in-out;
-ms-transition: background-color 0.5s ease-in-out;
transition: background-color 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
-ms-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
opacity:1;
}
With this, if i hover over the image, my text and background colors animating in and when i leave the image the text and background color is animating out. It works okay. (even though, my above code is a bit unsorted for now)
So, all i want is that the fading in and out animation will be fully executed even if i just hover fast over the image and back.
I think it is not possible is it? (with css only i mean)
I am afraid, you would have to use a bit of Javascript because as far as I know, it is not possible to do it without javascript.
Add a class on hover, and remove it on animation end. Refer to this answer to know how to do that - css3 animation on :hover; force entire animation
PS: I would have put this is a comment, but I don't have the privileges right now.
I've got a dropdown menu that uses lists to achieve it. The sub menu has a height of 0 and then the hight changes when the user hovers over it.
The limit of the animation is that I can't set the max-height as auto so I've set it to a value that it unlikley that the sub menu will ever reach.
Since the tranistion time is based on the max-height is is very fast so I've slowed it down to be a suitable speed but what I'd like is to have it disappear a lot faster when someone un-hovers or even have it disppear immediately. Is there a way to do this?
.menu ul ul{
float: left;
padding: 0;
position: absolute;
text-align: left;
width: 274px;
z-index: 1000;
max-height: 0;
overflow: hidden;
-webkit-transition: max-height 1s ease-in;
-moz-transition: max-height 1s ease-in;
-o-transition: max-height 1s ease-in;
-ms-transition: max-height 1s ease-in;
transition: max-height 1s ease-in;
}
.menu ul li:hover ul, .menu li.over ul {
max-height: 999px;
}
I'd like to stick to CSS but I'm willing to use JavaScript.
Try this :
For the basic class ( not the :hover ), just define the transition duration you want for when the list will disapear.
On hover, define a new transition duration ( the duration that the list will take to appear ).
Quick exemple here : http://codepen.io/AxelCardinaels/pen/wBQZbm
HTML :
<div class="text">Some texte</div>
CSS :
.text{
background:blue;
transition:all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in;
-moz-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
-ms-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
}
.text:hover{
background:red;
transition-duration:2s;
}
When I use the Transition on a css element the things below it move. Here is an example on JSFiddle:
http://jsfiddle.net/pgdxd7su/ (Look at the JSFiddle one. The code snippet seems not to work)
h1{
font-size
}
h1:hover{
display: inline;
font-size: 3em;
-webkit-transition: font-size .2s linear;
-moz-transition: font-size .2s linear;
-ms-transition: font-size .2s linear;
-o-transition: font-size .2s linear;
transition: font-size .2s linear;
}
<!DOCTYPE html>
<body>
<h1>Hello</h1>
<hr>
</body>
Would there be a way to fix this and keep the hr from moving?
well, the easy cross-browser answer is to change your HTML markup to this:
<div id="h1box">
<h1>Hello</h1>
</div>
and then you can use your CSS like this:
#h1box {
position:relative;
height:80px;
border-bottom:1px solid #333;
}
h1 {
position:absolute;
top:5px left:5px;
}
h1:hover {
display: inline;
font-size: 3em;
-webkit-transition: font-size .2s linear;
-moz-transition: font-size .2s linear;
-ms-transition: font-size .2s linear;
-o-transition: font-size .2s linear;
transition: font-size .2s linear;
}
Basically we're getting rid of the difference between browser renderings of hr element, using more simple and easily to adapt elements like div, then removing the flow of elements by applying a position:absolute to the h1 element so the animation won't affect anything below it. Easy and cross-browser solution that will look teh same in every browser.
See fiddle here
I suppose what you need to fix is just the bad animation on hover,
perhaps this is what you want: Fiddle
your animation looks bad because you declare display: inline; inside the :hover and not in the main element itself, which will make the default display: block; from the <h1> changed to display: inline; only when it's hovered. It's jumping up and down because an inline element can't have a margin which <h1> on default, so the what you need to avoid the bad animation is either change your style to one of this
h1 {
-webkit-transition: font-size .2s linear;
-moz-transition: font-size .2s linear;
-ms-transition: font-size .2s linear;
-o-transition: font-size .2s linear;
transition: font-size .2s linear;
}
h1:hover {
font-size: 3em;
}
this will keep the default block element of the <h1>
h1 {
display: inline;
-webkit-transition: font-size .2s linear;
-moz-transition: font-size .2s linear;
-ms-transition: font-size .2s linear;
-o-transition: font-size .2s linear;
transition: font-size .2s linear;
}
h1:hover {
font-size: 3em;
}
this will change the default block element of the <h1> to inline
h1 {
margin: 0;
-webkit-transition: font-size .2s linear;
-moz-transition: font-size .2s linear;
-ms-transition: font-size .2s linear;
-o-transition: font-size .2s linear;
transition: font-size .2s linear;
}
h1:hover {
display: inline;
font-size: 3em;
}
this will change the default block element of the <h1> to inline on hover, but removing the default margin which makes it jumpy (this will result the same with the second one)
I've been thinking about this issue for the past few days but I can't figure out what exactly is the problem.
Consider the following snippet from style.css:
.tint:before {
-moz-transition: all .3s linear;
-webkit-transition: all .3s linear;
-ms-transition: all .3s linear;
-o-transition: all .3s linear;
transition: all .3s linear;
}
.tint:hover:before {background:rgba(159,182,205,0.1);}
As you can see from the code above, upon an image hover, a "tint" transition should occur as to make the user want to click on that image. However, this feature does not work in Chrome.
Why does the hover transition not work in Chrome yet works perfectly fine in Firefox?
Is this the expected behavior? Or does Chrome not render these transitions correctly?
The problem is related to the :before pseudo class. It doesn't seem like hover is being triggered on that class. If you remove it, it works just fine.
.tint {
-moz-transition: all .3s linear;
-webkit-transition: all .3s linear;
-ms-transition: all .3s linear;
-o-transition: all .3s linear;
transition: all .3s linear;
}
.tint:hover{background:rgba(159,182,205,0.1);}
Here is the jsFiddle - http://jsfiddle.net/qGAn9/
UPDATE:
If :before pseudo element is needed, then you can trigger the hover on the parent element. I also had to add some additional styles to make the pseudo element appear on top.
.tint:before {
-moz-transition: all .3s linear;
-webkit-transition: all .3s linear;
-ms-transition: all .3s linear;
-o-transition: all .3s linear;
transition: all .3s linear;
content: "";
width: 100%;
height: 100%;
position: absolute;
}
.tint:hover:before{background:rgba(159,182,205,0.5);}
jsFiddle here - http://jsfiddle.net/qGAn9/2/