  .item {
        max-width: max-content;
        box-sizing: border-box;

        padding: 10px 20px;
        background-color: blue;
    }
    .content {
        width: 50px;
        height: 50px;
        background-color: green;
    }
</style>
<div class="grid">
    <div class="item">
        <div class="content"></div>
    </div>
    <div class="item">
        <div class="content"></div>
    </div>
</div>
