我目前正在嘗試制作一個博客。當我嘗試對帖子正文進行“預覽”時。第一篇文章似乎沒問題,但第二篇文章超出了它的 div。我嘗試更改要使用的標簽和 css 格式,但它仍然如此。我的代碼:超文本標記語言<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>CSShtml { 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;}任何幫助,將不勝感激。
添加回答
舉報
0/150
提交
取消
