After shrinking the div, it is still in the middle.


div,div,csstransform:scale,transform-origin:left


,div,,,...
div,css,js,(vuedemo)

this is without transform-origin:left. Less centered and weirder.

Jun.20,2021

isn't the transform-origin: left in your CSS just not going to center it?


Hello, open DEMO to change the width and height of any element in the console, which will be centered. I hope it will be helpful to you!

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        div{
            position: absolute;
            width: 300px;
            height: 300px;
            background-color: red;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>
</head>
<body>
    <div id="box"></div>
</body>
</html>

I don't know what you're going to do.
will you center an element first? Well, I thought you would
for simplicity, I used this to center left:0;right:0;top:0;bottom:0;

.

http://jsrun.net/EKhKp/edit

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4dae0-668f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4dae0-668f2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?