Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill the gap while scale

How can fill the gap at the bottom while using -webkit-transform:?

There is a gap when div becoming small. How can I fix this gap?

enter image description here

Here is the code

<div id="popUp">
    <div id="trans">
        <h1>hover me</h1>
    </div>
    <p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate</p>
</div>

CSS

#popUp{
    height: auto;
    width:400px;
    background: #EEE;    
}
#trans{
    width:100%;
    height:200px;
    background: yellow;

    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    -webkit-transition: all 0.5s;
    transition: all 0.5s;

    -webkit-transform-origin: left top 0;
       -moz-transform-origin: left top 0;
         -o-transform-origin: left top 0;
        -ms-transform-origin: left top 0;
            transform-origin: left top 0;
}
#trans:hover{
    -moz-transform: scale(.5);
    -ms-transform: scale(.5);
    -o-transform: scale(.5);
    -webkit-transform: scale(.5);
    transform: scale(.5)
}
h1{
    text-align: center;
}

Demo: http://jsfiddle.net/sweetmaanu/XpJEQ/3/

I couldn't find a proper solution.

like image 429
Mo. Avatar asked May 09 '13 15:05

Mo.


People also ask

How do you fill plastic gaps?

When plastic is punctured, it seems tricky to fix at first. Luckily, there are ways to fix and patch plastic without completely replacing it. A makeshift cement from super glue and baking soda can fill small holes in a pinch. Larger holes in plastic can be filled with melted plastic or epoxy.

Which of the following is used for filling the gaps?

Inpainting method is used for filling gaps in digital image.


1 Answers

The only solution I can think of would be to remove the element from the DOM flow (set it's parent to position: relative, then absolutely position the element) and animate the padding-top of the subsequent element.

Demo: http://jsfiddle.net/XpJEQ/7/

CSS (minus vendor prefixes):

#popUp {
    background: #EEE;
    position: relative;
    width: 400px;
    max-height: 300px;
}
#trans {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: yellow;
    transition: all 0.5s;
    transform-origin: left top 0;
}
#trans:hover { transform: scale(.5); }
#trans + * {
    padding-top: 210px;
    transition: all 0.5s;
}
#trans:hover + * { padding-top: 110px; }
h1 { text-align: center; }

HTML:

<div id="popUp">
    <div id="trans">
        <h1>hover me</h1>
    </div>
    <p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate</p>
</div>
like image 146
A.M.K Avatar answered Oct 03 '22 22:10

A.M.K