css-transforms

Weird behavior when rotating an element on hover

删除回忆录丶 提交于 2019-11-28 12:28:51
问题 Given these two examples. Using Hover div { position: absolute; width: 150px; height: 40px; background: orange; left: 50%; top: var(--top); transition: transform 2s; transform: translateX(-50%); text-align: center; line-height: 40px; font-size: 1.2em; } div:hover { transform: translateX(-50%) rotate(var(--deg)); } div:nth-child(1) { --deg: 180deg; --top: 20%; } div:nth-child(2) { --deg: -180deg; --top: 40%; } div:nth-child(3) { --deg: 360deg; --top: 60%; } <div>180deg</div> <div>-180deg</div>

CSS3 transform difference in Firefox and Chrome and IE

血红的双手。 提交于 2019-11-28 11:38:46
问题 I think it may have something to do with a pseudo element, but I'm not sure. I am having difficulties with the effect of a transform transition using css3. In Firefox v24, the effect works as I want it to - see the CodePen here http://codepen.io/patrickwc/pen/aKEec but in Chrome and IE, the border effect of the links animate and then suddenly switch back into position. It is difficult to describe so the best way is to look at the effect in Firefox then in Chrome or IE. body { background: #000

CSS3 animation not working in IE9

旧街凉风 提交于 2019-11-28 11:08:01
CSS3 animations are not working in IE9. Here is the jfiddle link . Is it possible to make them working on IE or i am making some silly mistake? Here is the code which is not working: @-ms-keyframes rotating { 0% { -ms-transform: rotate(0deg); } 100% { -ms-transform: rotate(360deg); } } #rotateMe{ -ms-animation: rotating 5s linear infinite; } As IE doent support this functionality i have created the fallback using jquery rotate plugin here is my fallback function for IE: $(function() { if (!$.support.transition){ var angle = 0; var angle2 = 0; setInterval(function(){ angle+=0.3; angle2-=0.3; $(

div slanted in 2 directions

回眸只為那壹抹淺笑 提交于 2019-11-28 09:28:23
Is it possible to create the following shape as a DIV in CSS . The browser support is not important. You cannot skew an element like this directly, you'll need to use two elements (or generated content) and hide certain overflow to make the flat bottom edge: http://jsfiddle.net/6DQUY/1/ #skew { height: 240px; overflow: hidden; } .skew { background: #000; display: inline-block; height: 300px; width: 500px; margin-top: 100px; transform: skew(-8deg, -8deg); } Note: I removed the cross browser definitions for better readability. UPDATE: This would be a more fluid example which resizes in set

How can I apply multiple transform declarations to one element?

和自甴很熟 提交于 2019-11-28 08:54:39
I have an element with two classes, one called "rotate" that will rotate the element 360 degrees and another called "doublesize" that will scale the element 2x its normal size: .rotate { transform: rotate(0deg); } .rotate:hover { transform: rotate(360deg); } .doublesize { transform: scale(1); } .doublesize:hover { transform: scale(2); } http://jsfiddle.net/Sbw8W/ I'm guessing this does not work because the classes override each other's transform property? I know that I could easily do this in one CSS rule like: .doublerotatesize { transform: scale(1) rotate(0deg); } .doublerotatesize:hover {

CSS transform: scale does not change DOM size?

試著忘記壹切 提交于 2019-11-28 08:33:12
问题 Container's DOM width after transform is the same as before transform? Why? var theScale = aNumber; var containerWidth = theContainer.width(); alert(containerWidth); // and the other prefixes, as well theContainer.css("-webkit-transform", "scale(" + theScale + ")"); containerWidth = theContainer.width(); alert(containerWidth); // the same value ??? 回答1: Transforms don't affect the layout — or more precisely the box model — of an element. They are purely cosmetic. From the spec: Note:

What is the right combination of prefixes for CSS transitions and transforms?

夙愿已清 提交于 2019-11-28 08:14:58
What would be the right way to prefix this CSS in order to cover the widest range of browsers and versions? Version 1: -webkit-transition: -webkit-transform .3s ease-in-out; -moz-transition: -moz-transform .3s ease-in-out; -ms-transition: -ms-transform .3s ease-in-out; -o-transition: -o-transform .3s ease-in-out; transition: transform .3s ease-in-out; -webkit-transform: rotateX(-30deg); -moz-transform: rotateX(-30deg); -ms-transform: rotateX(-30deg); -o-transform: rotateX(-30deg); transform: rotateX(-30deg); Or version 2: -webkit-transition: transform .3s ease-in-out; -moz-transition:

Re-sizing a cube

拜拜、爱过 提交于 2019-11-28 07:27:37
问题 I have a set of codes from the cube created using CSS. However, how do I resize this into a bigger cube (for example, 200px)? I have tried but everytime I try doing it, it goes out of position.. .mainDiv { position: relative; width: 206px; height: 190px; margin: 0px auto; margin-top: 100px; } .square { width: 100px; height: 100px; background: #c52329; border: solid 2px #FFF; transform: skew(180deg, 210deg); position: absolute; top: 43px; } .square2 { width: 100px; height: 100px; background:

Overflow behavior after using CSS3 transform

 ̄綄美尐妖づ 提交于 2019-11-28 06:26:19
Please check the demo I have two div s the first div is used for showing the scroll-bar and the second div is used for the rotation of inner contents of the div . My question is why scroll-bar is showing even if there is no overflow of the inner contents. Please check the demo and tell me what I am doing wrong here and how to overcome this issue or any alternative way to achieve this. HTML <div style="width: 1096px; height: 434px; overflow: auto; position: relative; border:solid 5px #555555"> <div id="RotationDiv"> <img style="left: 54px; top: 337px; width: 326px; height: 422px; position:

How to get the position of element transformed with css rotate

六月ゝ 毕业季﹏ 提交于 2019-11-28 05:52:45
I'm having a problem with getting the position of a div after rotate filter is applied to it. I have the position of one end, its height, and the angle by which it is rotated, but after checking what this filter actually does on MDN ("[cos(angle) sin(angle) -sin(angle) cos(angle) 0 0]") I still don't know how to crack it. Example : The div I'm interested in is the dashed line. Its styling at that moment was : left: 80px; top: 12px; height: 69.5122px; width: 2px; -moz-transform: rotate(-1.21366rad); ( top / left describe the position of its beginning.) I'm trying to get the top / left position