
- Bootstrap 教程
- Bootstrap - 首頁
- Bootstrap - 概述
- Bootstrap - 環境配置
- Bootstrap - 從右到左 (RTL)
- Bootstrap - CSS 變數
- Bootstrap - 顏色模式
- Bootstrap 佈局
- Bootstrap - 斷點
- Bootstrap - 容器
- Bootstrap - 網格系統
- Bootstrap - 列
- Bootstrap - 間距
- Bootstrap - 實用工具類
- Bootstrap - CSS 網格
- Bootstrap 元件
- Bootstrap - 手風琴
- Bootstrap - 警報
- Bootstrap - 徽章
- Bootstrap - 麵包屑
- Bootstrap - 按鈕
- Bootstrap - 按鈕組
- Bootstrap - 卡片
- Bootstrap - 走馬燈
- Bootstrap - 關閉按鈕
- Bootstrap - 摺疊
- Bootstrap - 下拉選單
- Bootstrap - 列表組
- Bootstrap - 模態框
- Bootstrap - 導航欄
- Bootstrap - 導航 & 標籤頁
- Bootstrap - 側邊欄
- Bootstrap - 分頁
- Bootstrap - 佔位符
- Bootstrap - 氣泡提示
- Bootstrap - 進度條
- Bootstrap - 滾動監聽
- Bootstrap - 載入動畫
- Bootstrap - 提示框
- Bootstrap - 工具提示
- Bootstrap 表單
- Bootstrap - 表單
- Bootstrap - 表單控制元件
- Bootstrap - 選擇框
- Bootstrap - 複選框 & 單選按鈕
- Bootstrap - 範圍滑塊
- Bootstrap - 輸入組
- Bootstrap - 浮動標籤
- Bootstrap - 佈局
- Bootstrap - 表單驗證
- Bootstrap 輔助類
- Bootstrap - 清除浮動
- Bootstrap - 顏色 & 背景
- Bootstrap - 彩色連結
- Bootstrap - 焦點環
- Bootstrap - 圖示連結
- Bootstrap - 定位
- Bootstrap - 比例
- Bootstrap - 堆疊
- Bootstrap - 拉伸連結
- Bootstrap - 文字截斷
- Bootstrap - 垂直線
- Bootstrap - 視覺隱藏
- Bootstrap 實用工具類
- Bootstrap - 背景
- Bootstrap - 邊框
- Bootstrap - 顏色
- Bootstrap - 顯示
- Bootstrap - 彈性盒子
- Bootstrap - 浮動
- Bootstrap - 互動
- Bootstrap - 連結
- Bootstrap - 物件適應
- Bootstrap - 不透明度
- Bootstrap - 內容溢位
- Bootstrap - 定位
- Bootstrap - 陰影
- Bootstrap - 尺寸
- Bootstrap - 間距
- Bootstrap - 文字
- Bootstrap - 垂直對齊
- Bootstrap - 可見性
- Bootstrap 演示
- Bootstrap - 網格演示
- Bootstrap - 按鈕演示
- Bootstrap - 導航演示
- Bootstrap - 部落格演示
- Bootstrap - 滑塊演示
- Bootstrap - 走馬燈演示
- Bootstrap - 頁首演示
- Bootstrap - 頁尾演示
- Bootstrap - 英雄圖演示
- Bootstrap - 特色演示
- Bootstrap - 側邊欄演示
- Bootstrap - 下拉選單演示
- Bootstrap - 列表組演示
- Bootstrap - 模態框演示
- Bootstrap - 徽章演示
- Bootstrap - 麵包屑演示
- Bootstrap - 特大標題演示
- Bootstrap-粘性頁尾演示
- Bootstrap-相簿演示
- Bootstrap-登入演示
- Bootstrap-定價演示
- Bootstrap-結賬演示
- Bootstrap-產品演示
- Bootstrap-封面演示
- Bootstrap-儀表盤演示
- Bootstrap-粘性頁尾導航欄演示
- Bootstrap-砌體佈局演示
- Bootstrap-入門模板演示
- Bootstrap-從右到左相簿演示
- Bootstrap-從右到左結賬演示
- Bootstrap-從右到左走馬燈演示
- Bootstrap-從右到左部落格演示
- Bootstrap-從右到左儀表盤演示
- Bootstrap 有用資源
- Bootstrap - 問答
- Bootstrap - 快速指南
- Bootstrap - 有用資源
- Bootstrap - 討論
Bootstrap - 內容溢位
本章討論 Bootstrap 的溢位實用工具。溢位實用工具類用於控制元素內溢位內容的行為。
Bootstrap 提供了幾個與溢位相關的實用工具類。預設情況下,這些類不是響應式的。
類 | 描述 |
---|---|
.overflow-auto | 如果內容超出元素尺寸,則自動向元素新增捲軸。 |
.overflow-hidden | 當內容超出元素尺寸時隱藏內容。 |
.overflow-scroll | 無論內容是否超出元素尺寸,都向元素新增捲軸。 |
.overflow-visible | 允許內容超出元素尺寸而不裁剪或滾動。 |
讓我們來看一個例子
示例
您可以使用編輯和執行選項編輯並嘗試執行此程式碼。
<!DOCTYPE html> <html> <head> <title>Bootstrap - Overflow</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container p-3"> <h4 class="text-start text-primary"> Overflow utility example</h4> <div class="overflow-auto mt-3 pb-5 bg-light" style="max-width: 360px; max-height: 80px;"> <code>.overflow-auto</code> is a class applied on an element with set width and height dimensions. By design, this content will vertically scroll, if overflowing. </div> <div class="overflow-hidden mt-5 pb-5 bg-light" style="max-width: 360px; max-height: 80px;"> <code>.overflow-hidden</code> is a utility class that is applied on an element with set width and height dimensions. This will hide the contents, when overflowing. </div> <div class="overflow-visible mt-5 pb-5 bg-light" style="max-width: 360px; max-height: 80px;"> <code>.overflow-visible</code> is a utility class that is applied on an element with set width and height dimensions. This will not hide the contents, when overflowing. </div> <div class="overflow-scroll mt-5 pb-5 bg-light" style="max-width: 360px; max-height: 80px;"> <code>.overflow-scroll</code> is a utility class that is applied on an element with set width and height dimensions. This will always show a scroll bar irrespective of whether the content will overflow or not. </div> <div class="overflow-scroll mt-5 pb-5 bg-light" style="max-width: 360px; max-height: 80px;"> <code>.overflow-scroll</code> is a utility class that shows a scroll bar always. </div> </div> </body> </html>
overflow-x
overflow-x 屬性用於控制元素的水平溢位行為。它確定當元素內的內容超出其水平軸上的寬度時會發生什麼。
overflow-x 屬性可以具有以下值:
類 | 描述 |
---|---|
.overflow-x-auto | 如果內容超出元素寬度,則自動向元素新增水平捲軸。 |
.overflow-x-hidden | 當內容超出水平軸上的元素寬度時隱藏內容。 |
.overflow-x-scroll | 無論內容是否超出元素寬度,都向元素新增水平捲軸。 |
.overflow-x-visible | 允許內容超出水平軸上的元素尺寸而不裁剪或滾動。 |
讓我們來看一個例子
示例
您可以使用編輯和執行選項編輯並嘗試執行此程式碼。
<!DOCTYPE html> <html> <head> <title>Bootstrap - Overflow</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container p-3"> <h4>Overflow-x-* Example</h4> <div class="overflow-x-auto mt-3 pb-5" style="max-width: 340px; max-height: 90px;"> <code>.overflow-x-auto</code> allows the users to scroll horizontally and view the overflowed content. </div> <div class="overflow-x-hidden mt-5 pb-5" style="max-width: 340px; max-height: 85px;"> <code>.overflow-x-hidden</code> is a class applied on an element with set width and height dimensions. This will hide the contents, when overflowing, along the x-axis. </div> <div class="overflow-x-visible mt-5 pb-5" style="max-width: 340px; max-height: 80px;"> <code>.overflow-x-visible</code> is a class applied on an element with set width and height dimensions. This will not hide the contents, even when overflowing, along the x-axis. </div> <div class="overflow-x-scroll mt-5 pb-5" style="max-width: 340px; max-height: 120px;"> <code>.overflow-x-scroll</code> This ensures that a horizontal scrollbar is always present, even if there is no actual overflow along the horizontal axis. </div> </div> </body> </html>
overflow-y
overflow-y 屬性用於控制元素的垂直溢位行為。它確定當元素內的內容超出其垂直軸上的高度時會發生什麼。
overflow-y 屬性可以具有以下值:
類 | 描述 |
---|---|
.overflow-y-auto | 如果內容超出元素高度,則自動向元素新增垂直捲軸。 |
.overflow-y-hidden | 當內容超出垂直軸上的元素高度時隱藏內容。 |
.overflow-y-scroll | 無論內容是否超出元素高度,都向元素新增垂直捲軸。 |
.overflow-y-visible | 允許內容超出垂直軸上的元素尺寸而不裁剪或滾動。 |
讓我們來看一個例子
示例
您可以使用編輯和執行選項編輯並嘗試執行此程式碼。
<!DOCTYPE html> <html> <head> <title>Bootstrap - Overflow</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container mt-3"> <h4>Overflow-y-* Example</h4> <div class="overflow-y-auto mt-3 pb-5" style="max-width: 340px; max-height: 80px;"> <code>.overflow-y-auto</code> allows the users to scroll vertically and view the overflowed content. In order to adjust the content, a vertical scroll bar should appear. </div> <div class="overflow-y-hidden mt-5 pb-5" style="max-width: 340px; max-height: 80px;"> <code>.overflow-y-hidden</code> is a class applied on an element with set width and height dimensions. This will hide the contents, when overflowing, along the y-axis. </div> <div class="overflow-y-visible mt-5 pb-5" style="max-width: 340px; max-height: 70px;"> <code>.overflow-y-visible</code> is a class applied on an element with set width and height dimensions. This will not hide the contents, even when overflowing, along the y-axis. </div> <div class="overflow-y-scroll mt-5" style="max-width: 340px; max-height: 80px;"> <code>.overflow-y-scroll</code> This ensures that a vertical scrollbar is always present, even if there is no actual overflow along the vertical axis. </div> </div> </body> </html>
廣告