日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > HTML >内容正文

HTML

html溢出宽度控制,html - 具有固定宽度列的HTML / CSS表(如果内容溢出,则滚动) - 堆栈内存溢出...

發(fā)布時(shí)間:2023/12/31 HTML 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html溢出宽度控制,html - 具有固定宽度列的HTML / CSS表(如果内容溢出,则滚动) - 堆栈内存溢出... 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我有一個(gè)帶有一個(gè)或多個(gè)固定寬度列的HTML表。 有時(shí),此類(lèi)列的內(nèi)容超出了列的寬度,我想在表格列的底部使用一個(gè)滾動(dòng)條。

我想保持相同的語(yǔ)義HTML結(jié)構(gòu),并且沒(méi)有重復(fù)的表或多次迭代。

我想要盡可能少的JavaScript

如果可以的話(huà),我可以將其轉(zhuǎn)換為CSS Grid或Flexbox(但以前沒(méi)有使用過(guò))

我已經(jīng)注意到,HTML是一個(gè)colgroup ,看起來(lái)我可以設(shè)置width和其他CSS屬性,但不能overflow 。

First

Second long column item that should have scroll 1

Last column item

First

Second long column item that should have scroll 2

Last column item

First

Second long column item that should have scroll 3

Last column item

First

Second long column item that should have scroll 4

Last column item

First

Second long column item that should have scroll 5

Last column item

First

Second long column item that should have scroll 6

Last column item

.table {

table-layout: fixed;

border-collapse: collapse;

width: 100%;

}

.table-row {

box-shadow: 0 0 1px 1px yellowgreen;

}

.table-cell {

box-shadow: 0 0 1px 1px blue;

}

.table-colgroup--first {

background: palegoldenrod;

}

.table-colgroup--second {

background: paleturquoise;

/*

* I would like to pass the width of the column here

*/

width: 50px;

overflow-x: scroll;

}

.table-colgroup--third {

background: palegreen;

}

/* This is intentionally long so that a scrollbar appears somewhere */

.table-cell--second p {

width: 900px;

background: #666;

color: #fff;

}

請(qǐng)使用我嘗試過(guò)的代碼檢查我的Codepen示例: 代碼示例

總結(jié)

以上是生活随笔為你收集整理的html溢出宽度控制,html - 具有固定宽度列的HTML / CSS表(如果内容溢出,则滚动) - 堆栈内存溢出...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。