Αποτελέσματα Αναζήτησης
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 · Examples. 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.
In this tutorial, find some methods of creating an HTML table, which has a fixed header and scrollable body. Of course, you need to use CSS. It is possible to achieve such a result by setting the position property to “sticky” and specifying 0 as a value of the top property for the <th> element.
Example. Set different table layout algorithms: table.a { table-layout: auto; width: 180px; } table.b { table-layout: fixed; width: 180px; } Try it Yourself » Definition and Usage. The table-layout property defines the algorithm used to lay out table cells, rows, and columns.
7 Σεπ 2021 · Tables are a great way to represent tabular data, and you can create them using basic HTML elements like <table>,<tr>, <td>. And you can also add some styling to make them look good and present the data clearly with the help of a CSS file.
The position property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky).
/* styles table with fixed layout */ table { width: 500px; table-layout: fixed; } table, th , td { border: 1px solid black; border-collapse: collapse; } Browser Output In the above example, the table has the table-layout property set to fixed, and width is set to 500px .