如何在球数增加时增加框架的宽度

Duk*_*uke 5 html css

这是我的代码

.containerSlave {
    display: inline-flex;
    flex-direction: column;
    flex-wrap: wrap;
    margin: 2px 2px 2px 2px;
    padding: 2px 2px 2px 2px;
    height: 220px;
    /*item height x 10*/
    border: 2px solid red;
}

.containerSlave .ball {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    line-height: 20px;
    text-align: center;
    text-shadow: 0 1px 1px #000;
    font-size: 15px;
    color: #ffffff;
    margin: 2px 2px 2px 2px;
    background: radial-gradient(circle at 20px 15px, #7FBBFC, #000);
}
Run Code Online (Sandbox Code Playgroud)

当球处于有限高度状态并自动移动其纵向时,如何使球在框架内被覆盖.随着球的数量增加,框架将增加其宽度.

想要显示以下内容

小智 0

document.getElementById("containerSlave").style.width = s + "px";spizels 中的新尺寸一起使用(整数)。您需要width向 CSS 添加一个属性。

#containerSlave {
    display: inline-flex;
    flex-direction: column;
    flex-wrap: wrap;
    margin: 2px 2px 2px 2px;
    padding: 2px 2px 2px 2px;
    height: 220px;
    /*item height x 10*/
    border: 2px solid red;
    width: <!-- yourwidth --> px
}
Run Code Online (Sandbox Code Playgroud)

注意:将其更改<div class="containerSlave"><div id="containerSlave">