What is the strange effect of translate(-50%,-50%) on transform-origin in CSS3?
typecho
typecho 2017-06-08 11:02:26
0
1
926
 
  

When I use a negative margin-left method to align the center, and then zoom in when the mouse hovers, the center point is the upper and lower center set by transform-origin, and there is no problem:

But when I use transform:translate(-50%,-50%) for center alignment:

 
  

When the mouse hovers up, the center point of the magnification seems to go to the upper left corner. Even if I set transform-orgin, it still doesn't work.

From the console, the transform-origin attribute works. I am very confused as to why this is happening, please give me some advice

typecho
typecho

Following the voice in heart.

reply all (1)
大家讲道理

Obvious mistake, whenhoverthe originaltranslatewas overwritten

The correct way to write it is as follows

#test:hover{ transform: scale(1.2, 1.2) translate(-50%,-50%); }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!