I do opacity transition on img element as it is in here and i see that img size changing or img is moving when transition on end or start;
Here is simple css code for styling.
img{
height:165px;
width:165px;
opacity:0.4;
transition: all linear 1s;
}
img:hover{
opacity:1;
}
I tested it on Chrome 31 version. How can i get rid of this problem ?
Edit: This problem appears when Chrome browser is in bigger zoom like 110% or 125%
Seems to be a bug in Chrome, just transitioning the opacity makes no difference for me.
Apply a 3D transform, of nothing, to resolve the issue.
-webkit-transform: translateZ(0);
I don't see the movement but you can try with just the specific property instead of all:
transition: opacity linear 1s;
The demo http://jsfiddle.net/cKUFD/4/
I Had the same problem, so i tried different images in this fiddle:
https://jsfiddle.net/s04428yc/15/
The first image works fine, while the second contracts on hover.
So i came to the conclusion that the image ratio is causing the problem.
And the solution was, like #addedlovely already stated:
-webkit-transform: translateZ(0);
and this should be applied on the element without the hover pseudo selector.
Or one could simply change the actual image ratio.
Adding a 1px transparent border to the right of the element fixed this for me. I had a grid of images with no space at all between them, and this bug would cause some of them to expand by 1 pixel horizontally when the transition happened.
-webkit-transform: translateZ(0); does work, however, it also changed the width of some of the images by 1px permanently. (This fix also changes the width of the images by 1px permanently, but at least it's consistent.)
I ended up liking the look of a 1 pixel border more anyway and so I kept it, but this obviously won't be a fix for everyone because it changes the look of your page.
Related
I've been going crazy about that and haven't found a solution yet, any content in the div gets blured for some reason if a transform is being applied.
Though this only happens in chrome.
I've tried using the Webkit style declaration : -webkit-font-smoothing but I didn't succeed.
The div CSS:
#divId {
width: 100%;
height: 100%;
-webkit-transform: translateX(-52%);
transform: translateX(-52%);
}
below are 2 images showing the difference with and without the transform,
the first is with transform and the second is without the transform. thanks
try moving the div without transform
like using { position:relative;left:-52%;}
transform usually changes the quality of a text or img ( like translate or scale ) and as far as i know there is no 100% accurate work around about this
I have a div that functions as an information box, giving extra information on the item it is associated with. Now this div might contain any amount of content, so I cannot fix the height in the css. This would be fine, but I would also like this div to have a nice transition when the user opens it, and this is where I run into a problem. I have all the transitions working correctly, and they are here (+ open/closed css)
#info.hidden {
opacity:0;
width:0px;
height:10px;
transition: width .5s ease-in-out, height .5s ease-in-out, opacity .5s ease-in-out, visibility 0s linear .5s;
/* with -moz- & -webkit- */
}
#info.visible {
width:150px;
transition: width .5s ease-in-out, height .5s ease-in-out, opacity .5s ease-in-out;
/* with -moz- & -webkit- */
}
The problem I have is that the small width during the transition causes the text to wrap, extending the height of the box and not having the desired effect. Ideally, the height would expand smoothly from 10px to the height of the text, but instead it follows the bottom of the text all the way through the transition. Also on close the height jumps straight to 10px.
This problem can be seen here: http://jsfiddle.net/Daniel300/1nhs9w78/.
I have tried various things, including adding a wrapper div to the text, hoping that the wrapper div would overflow past the bottom (or the side) of the div during the transition. I also messed about with the display and overflow properties, but nothing seemed to work.
Thanks for any help!
I found a way to do this that is not quite a valid solution, but is a workaround. It seems to be the best I can do for now.
Firstly, adding white-space: nowrap; to the div prevented the text from, well, wrapping, and extending the div.
Secondly, I found this post which I saw before but I thought that it didn't work (possibly I set the value too high). Essentially, you can't transition from fixed value to auto (which is what I was trying to do). Therefore you must instead transition the max-height up to a value it will never reach. Obviously I can't strictly speaking do this as per my question, but I can set it to a reasonable maximum value.
Here is my new code: https://jsfiddle.net/Daniel300/mfegxzuc/.
Not perfect, but possibly as good as I'm going to get with CSS.
I use google fonts to show some h1 tag. Initially, this h1 tag is hidden using:
visibility: hidden;
opacity: 0
I then slowly reveal the text when you hover over it with the following:
.content:hover{
visibility: visible;
opacity: 1;
transition: opacity ease-in-out 1s;
}
See here for demo: http://codepen.io/gosusheep/pen/oXEyve
Whenever the content becomes fully visible, it jumps a bit.
This jumping does not happen when the content is already visible.
This content does happen with other non-websafe fonts (e.g. Georgia).
Does anyone know a way around this?
After adding a margin: 20px, everything works as expected. I was able to keep the transform as well.
What I believe is happening is that the font requires more space than the content div actually has. When opacity reaches 1, the text is fully rendered and goes outside the bounds of the div, causing a small shift.
the problem is not with the visibility, the problem is the transform and transition together, try center the content with top: 50%; and margin-top: negative_half_of_the_div_heigh;.
I have a weird problem with my personal website. Let me explain the context:
I have some stacked sections which have to be (each one) the same height as browser window. That is, if the browser window has 500px of height and I have 5 sections, the whole website would be 500*5 = 2500px height.
If I just define my sections with height: 100% them remain 0px height. To solve that I used the next trick:
html, body {
height: 100%;
}
This way, the container of the sections (the body) has also 100% height of the browser window, so my sections now have the desired height.
But after that, I want that the background color of the body changes depending on the section we are. This causes an strange problem. The color doesn't change in a logical way. Better see it on my website. This seems to be related with the fact that the body is actually smaller than my website. Remember, my body has 100% height (for example, 500px) and my website 100% * number of sections (2500px). But I'm not really sure about that because I tried to reproduce the error on a simple fiddle and I can't.
A curious thing is if you mouseover my website logo (which have a transition animation related with a rotation transform) the background change its color correctly. Something related with website refreshing, I suppose.
By the way, the color of the body is also changing with a transition, but you can disconnect it on the inspector if you want. That seems no to be the problem.
If you need more information please ask for it. Thank you for your help and attention.
PS: This happens on Chrome 32. In Firefox all works. So compare both browsers to understand better the problem, if you want.
I partially solved the problem with pseudoelements (then, I don't lose the semantics of my html) but I'm not satisfied because I think it has to be a better and cleaner way.
I put all the sections inside a div called "main-content" (of the website). Then I also defined this div with height: 100% (otherwise the height trick stops working). Then I define a before pseudoelement with this css:
#main-content:before {
content: "";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
-webkit-transition: background-color $speed;
-moz-transition: background-color $speed;
-o-transition: background-color $speed;
-ms-transition: background-color $speed;
transition: background-color $speed;
}
And then I attach to this fixed layer pseudoelement all the changing background color code, instead of using body. This works, but fixed elements and mobile browsers aren't good friends. So I think that this problem deserves a better solution.
I am stumped after a very humbling 15 hours worth of attempts. :/ I am doing a freebie because it looked like a simple opp to test theories for a device responsive site. Not. I have a feeling like maybe I am overthinking it. It is something I am working hard to learn. Any feedback or push in the right direction would be greatly appreciated. I am new to both HTML5 and coding for devices first.
Using: http://byevan.com/web-template/BuzzApp/
Test Site: http://justimaginewebdesigns.com/nathalie/mobile/
Image attached of what it should end up looking like on all devices.
Using a javascript to anchor the div for the links to the bottom.
Issue: Div container for links is not responsive in harmony with the bg image.
Using CSS3 for the main bg image make that responsive and the #media entries do their job although it is best viewed in landscape mode due to the bg image itself.
Using % based margins are inconsistent
Using % based relative positioning is inconsistent
Attempting to scrap keeping text and just using an image with hotspot rollovers fails miserably across devices.
Adding a left position attribute to the javascript mentioned above is inconsistent across devices.
Many more experiment attempts...
This should get what you're after for assuming you'll go with a mobile first design.You might need to add another few breapoints to get left margin right as the screen size increases.
You also should drop the image widths and heights off the navigation items and use
img {
width: 100%;
max-width: 100%;
}
and then set the widths of the images on the container divs.
.homelinks {
position:fixed;
bottom:100px;
left: 5%;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
#media Screen and min-width(700px){
.homelinks {
position:fixed;
bottom:100px;
left: 26%;
}}