I'm currently trying to make a blog. When I try to make a "preview" of the body of the post. The first post seems to be fine, but the second post goes over its div. I tried changing what tags to use and css formatting but it stays like that.
My code:
HTML
<div class="module">
        <div class="blog">
            <div class="recents">
                <h2>Recent Posts</h2>
                <br><br>
                <?php
                $sql = "select title, body, created_at FROM posts";
                $result = mysqli_query($link, $sql);
                $query = mysqli_query($link, $sql) or die(mysqli_error($link));
                while ($row = mysqli_fetch_assoc($query)) {
                    $title = $row['title'];
                    $body = $row['body'];
                    $created_at = $row['created_at'];
                    if (strlen($body) > 500) {
                        $body = substr($body, 0, 500);
                    }
                    echo "<h3>" .  $title . "</h3><br>";
                    echo "<p>" .  $body . "</p>";
                    echo "<small>" .  $created_at . "</small>";
                    echo "<br><br>";
                }
                ?>
            </div>
            <div class="categories">
                <h3>Categories</h3>
            </div>
        </div>
CSS
html {
    font-family: 'IBM Plex Serif', serif;
}
.module {
    background-color: #fffff7;
    box-shadow: 3px 10px 18px #888888;
    padding-top: 70px;
    padding-left: 130px;
    border: 1px solid;
    width: 1080px;
    margin-left: 380px;
    height: 821px;
}
.blog {
    display: flex;
    flex-direction: row;
    text-align: left;
}
.recents {
    flex-grow: 2;
    width: 570px;
}
.categories {
    flex-grow: 1;
}
Any help would be appreciated.
