diff options
| author | Eltrac <hi@guhub.cn> | 2025-04-30 23:42:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-04-30 23:42:11 +0800 |
| commit | 2db7b66b734b78cb273f6560e364d946038b85fc (patch) | |
| tree | ab301b6d910fece3edfed4996a8fa663d178ece5 /assets/css/components | |
| parent | 4ed06823920334eeea2e9e00c0fc45c3e2978888 (diff) | |
feat: responsive table
- allow horizontal scroll when not having enough space on X axis
- maximun width for each cell
Diffstat (limited to 'assets/css/components')
| -rw-r--r-- | assets/css/components/_markdown.scss | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/assets/css/components/_markdown.scss b/assets/css/components/_markdown.scss index d1e1c50d..4378d398 100644 --- a/assets/css/components/_markdown.scss +++ b/assets/css/components/_markdown.scss @@ -109,17 +109,28 @@ $em-text-color: #889E73; background-color: rgba(255, 235, 0, .5) } - table { - border-collapse: collapse; - border-top: 2px solid var(--border-color); + .table-container { overflow-x: auto; - width: 100%; - tr { - border-bottom: 1px solid var(--border-color); - } - td, th { - padding: 0.5rem 1rem; - line-height: 1.5; + -webkit-overflow-scrolling: touch; + + table { + border-collapse: collapse; + table-layout: fixed; + min-width: 100%; + width: max-content; + + border-top: 2px solid var(--border-color); + + tr { + border-bottom: 1px solid var(--border-color); + } + td, th { + max-width: 200px; + padding: 0.5rem 1rem; + line-height: 1.5; + white-space: normal; + word-wrap: break-word; + } } } |
