列表超出容器範圍時隱藏,不顯示滾動條。
.container {
width: 300px;
height: 200px;
overflow: hidden; /* 核心屬性 */
/* 或 overflow: auto; 顯示滾動條 */
}
overflow-x: hidden; overflow-y: auto; 僅水平隱藏,垂直滾動。text-overflow: ellipsis; 配合 white-space: nowrap; overflow: hidden; 實現單行文本省略號。父容器必須有明確 width/height 或 max-width/max-height,否則 overflow 不生效。