diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eb493c..83cd8bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed + +- **A page narrow enough to hide columns gives up their shares without `!important`.** `LayoutCss` + hides a filling table's `` there instead of overriding each column's inline width, so a + site whose stylesheets forbid `!important` can carry the rule as written. + +## 2.11.0 — 2026-10-07 + ### Added - **Tables that fill their width.** `TableColumn.Grow` gives a column a share of the width a table has diff --git a/MarkupString.Html/LayoutCss.cs b/MarkupString.Html/LayoutCss.cs index bad9b0c..2354df8 100644 --- a/MarkupString.Html/LayoutCss.cs +++ b/MarkupString.Html/LayoutCss.cs @@ -87,6 +87,6 @@ public static class LayoutCss ".ms-table th { border-bottom: 1px solid var(--ms-header-rule, var(--ms-header-rule-default, currentColor)); color: var(--ms-heading, var(--ms-heading-default, inherit)); }\n" + ".ms-table.ms-striped > tbody > tr:nth-child(even) { background: var(--ms-stripe, var(--ms-stripe-default, rgba(127, 127, 127, 0.12))); }\n" + ".ms-table .ms-nowrap, .ms-table .ms-nowrap .ms-text { white-space: pre; overflow-wrap: normal; }\n" + - "@media (max-width: 48em) { .ms-table .ms-p3 { display: none; } .ms-table.ms-fill > colgroup > col { width: auto !important; } }\n" + + "@media (max-width: 48em) { .ms-table .ms-p3 { display: none; } .ms-table.ms-fill > colgroup { display: none; } }\n" + "@media (max-width: 32em) { .ms-table .ms-p2 { display: none; } }\n"; } diff --git a/MarkupString.Tests/Layout/WidgetLayoutTests.cs b/MarkupString.Tests/Layout/WidgetLayoutTests.cs index 9259463..026c7a3 100644 --- a/MarkupString.Tests/Layout/WidgetLayoutTests.cs +++ b/MarkupString.Tests/Layout/WidgetLayoutTests.cs @@ -243,7 +243,7 @@ public async Task Table_InHtml_AGrowingTableFillsThePage() await Assert.That(BlockLayout.Build(Who(), 60).Render(MarkupFormat.Html, Registry)).DoesNotContain("") .Because("a table that does not fill is as wide as its cells"); await Assert.That(LayoutCss.Fixed).Contains(".ms-table.ms-fill { width: 100%; }"); - await Assert.That(LayoutCss.Fixed).Contains(".ms-table.ms-fill > colgroup > col { width: auto !important; }") + await Assert.That(LayoutCss.Fixed).Contains(".ms-table.ms-fill > colgroup { display: none; }") .Because("on a page narrow enough to hide columns, their shares are given up"); }