Αποτελέσματα Αναζήτησης
I need to create a html table (or something similar looking) with a fixed header and a fixed first column. Every solution I've seen so far uses Javascript or jQuery to set scrollTop/scrollLeft, but it doesn't work smoothly on mobile browsers, so I'm looking for a pure CSS solution.
13 Αυγ 2024 · Fixed-width tables with text-overflow. This example uses a fixed table layout, combined with the width property, to restrict the table's width. The text-overflow property is used to apply an ellipsis to words that are too long to fit.
The table-layout property defines the algorithm used to lay out table cells, rows, and columns. Tip: The main benefit of table-layout: fixed; is that the table renders much faster. On large tables, users will not see any part of the table until the browser has rendered the whole table.
2 Ιουλ 2014 · With table-layout: fixed; Things get a lot sturdier and more predictable with property/value in place. The layout is fixed based on the first row. Set the width of those, and the rest of the table follows. It’s a little more complicated, but not much. Here’s an exploration: See the Pen Fixed Tables Solve Some Issues by Chris Coyier ...
The position property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky).
12 Αυγ 2024 · To do this, add the following CSS to your style.css file: css. /* spacing */ table { table-layout: fixed; width: 100%; border-collapse: collapse; border: 3px solid purple; } thead th:nth-child(1) { width: 30%; } thead th:nth-child(2) { width: 20%; } thead th:nth-child(3) { width: 15%; } thead th:nth-child(4) { width: 35%; } th,
11 Νοε 2013 · You can use CSS position: sticky; for the first row of the table MDN ref:.table-class tr:first-child>td{ position: sticky; top: 0; }