How to prevent child element infection for conversion scale in css3?
HTML
<div class="wrapper">
<div class="parent">
<div class="child">
lorem ipsum
</div>
</div>
</div>
CSS
.wrapper {
width: 300px;
height: 300px;
margin: 30px auto;
border: 1px dashed #ccc;
overflow:hidden;
}
.parent {
width: 1px;
height: 100px;
background-color: #f00;
opacity: 0;
margin: 0 auto;
-webkit-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.wrapper:hover .parent {
opacity: 1;
-webkit-transform: scaleX(300);
transform: scaleX(300);
}
.wrapper . parent .child {
-webkit-transform: none;
transform: none;
}
I want to scale only the .parent element when the .wrapper div hangs. But it also affects the two divs (parent and child), although it does provide the transform: none property for the .child div. How to prevent .child damage?
+4
1 answer
Instead transform: scaleXtry changing the width
.wrapper:hover .parent {
opacity: 1;
width: 100%;
}
http://jsfiddle.net/cdmkoao4/3/
Update:
, , scaleX width, , . .child .parent, div position: absolute. scaleX .parent, opacity .child ( , parent-child).
http://jsfiddle.net/cdmkoao4/9/
transition-delay, , .
+5