[英]CSS3 Transition to not effect other elements?
Is it possible to have height transitions that don't affect the position of nearby elements? 是否可以进行不影响附近元素位置的高度过渡?
This particular case involves divs with float:left. 这个特殊情况涉及带浮点数的div:left。
Demo: http://ashleystewart.me/ 演示: http : //ashleystewart.me/
I'd like the hover transition to go on top of the element you can see moving around. 我希望悬停过渡到你可以看到移动的元素之上。
Give the container boxes Relative positioning and the fly-out details box Absolute positioning. 给容器盒相对定位和飞出细节框绝对定位。 Since Absolute positioned elements are removed from the layout, it wont interfere with the floats.
由于绝对定位元素从布局中移除,因此它不会干扰浮动。
demo: http://dabblet.com/gist/3729269 演示: http : //dabblet.com/gist/3729269
I'm afraid that in the current layout-logic you're following, it'd be very hard to fix. 我担心在您关注的当前布局逻辑中,修复起来非常困难。
Why? 为什么? Because like your
floats
in the first row are aligned next to each other, when a box in the upper row is expanded on :hover
, the float
s in the bottom row will reposition relatively to that one as well. 因为像第一行中的
floats
一样是彼此相邻对齐的,当上一行中的一个框展开时:hover
,底行中的float
也会相对于那一行重新定位。
Here's how I would go about achieving your idea: 以下是我如何实现您的想法:
float
ing, use something like display: inline-block;
float
,使用像display: inline-block;
. article
wrappers are causing issues when using inline-block;
inline-block;
时,您的语义article
包装器会导致问题inline-block;
. overflow: hidden;
overflow: hidden;
when styling your "boxes." Sorry I couldn't be of more help! 对不起,我无法提供更多帮助!
You can use position
property instead of using float
property, you can do following: 您可以使用
position
属性而不是使用float
属性,您可以执行以下操作:
#idname {
position:fixed;
margin-right:100px;
margin-left:100px;
margin-top:100px;
margin-bottom:100px; /* I had written 100px only for example you can adjust it according to your screen */
}
#idname:hover {
-moz-transtion: /* adjust the setting here for Firefox */;
-webkit-transition: /* adjust the setting here for chrome and safari */;
-o-transition: /* adjust the setting here for Opera */;
}
This will enable the moving of div
and its position will be fixed. 这将使
div
的移动及其位置得以固定。
You could use a transition on a transform by using. 您可以使用转换在转换上使用。 Transform will change the element without effecting layout.
变换将更改元素而不影响布局。 You would want to use
transform: scaleY()
say you wanted to double the height of something: 你会想要使用
transform: scaleY()
说你想要加倍的东西:
transform: scaleY(2);
-webkit-transform: scaleY(2);
-moz-transform: scaleY(2);
-o-transform: scaleY(2);
Put the <div>
in a proper positioning. 将
<div>
置于适当的位置。 Keep the outside ones in position:fixed and the inner ones in position:absolute 保持外部位置:固定,内部位置:绝对
Or the other way is to make the maximum height fixed for the outer <div>
and the inner <div>
should be kept the maximum transformation height equal to the outer one. 或者另一种方法是使外部
<div>
的最大高度固定,内部<div>
应保持最大变换高度等于外部。 It will help in not making other <div>
getting affected on transaction 这将有助于不使其他
<div>
在交易中受到影响
Or the other way can be, use blocks to display the content, rather using float way 或者另一种方式是,使用块来显示内容,而不是使用float方式
您可以使用position: absolute
而不是position: fixed
,这样当您打开Web开发人员工具时div不会移动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.