The width of the external tag is smaller than that of the internal tag, so how to display it in the internal tag play

the width of the outer tag is smaller than that of the internal tag, so how to display

in the internal tag play?
Css
Mar.10,2021

give the location when the width is fixed:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .main{
            position: relative;
            width: 100px;
            margin: auto;
            height: 100px;
            border: 1px solid -sharpccc;
        }
        .main .child{
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            width: 200px;
            height: 100px;
            border: 1px solid -sharp333;
        }
    </style>
</head>

   <div class="main">
       <div class="child">

       </div>
   </div>
<body>

</body>
</html>

If the width of

is fixed, the internal tag uses margin-left:-*px, or translateX ()
. If the width is not fixed, use js to calculate the width difference, and use js to control margin-left;

.
Menu