Scrolling Table

This CCS and JS can be applied to a table to allow the header and first column to freeze when scrolling, allowing for a better expereicne on smaller screens.


Component Behavior

Scrolling both vertically and horizontally will freeze the headers, and it will snap between cells.


Accessibility Guidelines

Describe accessibility concerns and requirements with the item, as well as any best practices.


Component Example

Planets data

Data about the planets of our solar system (Planetary facts taken from Nasa's Planetary Fact Sheet - Metric).
Name Type Mass (1024kg) Diameter (km) Density (kg/m3) Gravity (m/s2) Length of day (hours) Distance from Sun (106km) Mean temperature (°C) Number of moons Notes
Mercury Terrestrial 0.330 4,879 5427 3.7 4222.6 57.9 167 0 Closest to the Sun
Venus Terrestrial 4.87 12,104 5243 8.9 2802.0 108.2 464 0
Earth Terrestrial 5.97 12,756 5514 9.8 24.0 149.6 15 1 Our world
Mars Terrestrial 0.642 6,792 3933 3.7 24.7 227.9 -65 2 The red planet
Jupiter Gas Giant 1898 142,984 1326 23.1 9.9 778.6 -110 67 The largest planet
Saturn Gas Giant 568 120,536 687 9.0 10.7 1433.5 -140 62
Kalxor-II Terrestrial 4.012 19,789 6.289 10.01 36.5 257.3 330 1 Has a surface with vast, labyrinthine cave systems
Aethonox Gas Giant 23.456 301,912 1.289 16.56 64.2 892.1 -50 36 Has a massive storm system with lightning-powered aurorae
Brynhildr Terrestrial 4.345 20,934 6.378 10.23 37.8 272.1 350 1 Has a surface with vast, mirror-like saltwater lakes
Cygnus-X Ice Giant 12.234 120,678 0.992 10.56 40.5 1,200.1 -100 23 Has a subsurface ocean with unique, bioluminescent marine life
Daxton-IV Gas Giant 24.678 312,345 1.312 17.01 66.2 882.1 -40 38 Has a massive ring system with moonlets and shepherd moons
Erebus-III Terrestrial 4.678 21,901 6.456 10.45 39.2 287.3 370 1 Has a surface with vast, towering mountain ranges
Flarion-II Ice Giant 12.678 122,901 0.994 10.67 41.5 1,220.1 -90 25 Has a highly active geology with frequent cryovolcanic eruptions
Gwynedd-IV Gas Giant 25.901 323,456 1.335 17.45 68.2 872.1 -30 40 Has a unique "stellar nursery" region with protostars and protoplanets
Hypatia-III Terrestrial 4.901 22,789 6.523 10.67 40.8 302.3 390 1 Has a surface with vast, labyrinthine cave systems
Xylaraea Gas Giant 30.123 373,456 1.417 19.45 76.2 832.1 10 48 Has a massive storm system with aurora-like displays
Vyctora Terrestrial 5.689 26,234 6.756 11.23 46.2 362.3 470 1 Has a surface with vast, iridescent salt flats
Xeridian Ice Giant 14.234 140,678 1.002 11.34 48.5 1,280.1 -60 31 Has a subsurface ocean with unique, bioluminescent marine life
Orianaea Gas Giant 31.456 383,912 1.429 20.01 78.2 822.1 20 50 Has a massive ring system with moonlets and shepherd moons
Vyntria Terrestrial 5.789 27,091 6.812 11.34 47.3 377.3 490 1 Has a surface with vast, towering mountain ranges
Zorvania Gas Giant 32.678 403,456 1.441 20.56 80.2 812.1 30 52 Has a unique "stellar nursery" region with protostars and protoplanets
Xylophia-IV Terrestrial 5.901 28,234 6.868 11.45 48.5 392.3 510 1 Has a surface with vast, labyrinthine cave systems
Vorthok-V Ice Giant 14.678 150,678 1.005 11.56 50.5 1,300.1 -50 33 Has a subsurface ocean with unique, bioluminescent marine life
Oberyn-IV Gas Giant 33.901 413,912 1.454 21.01 82.2 802.1 40 54 Has a massive storm system with aurora-like displays
Vynaria Terrestrial 6.012 29,345 6.923 11.56 49.6 407.3 530 1 Has a surface with vast, iridescent salt flats
Xeridion-IV Gas Giant 35.123 423,456 1.467 21.56 84.2 792.1 50 56 Has a massive ring system with moonlets and shepherd moons
Vyntara Terrestrial 6.123 30,567 6.978 11.67 50.7 422.3 550 1 Has a surface with vast, towering mountain ranges
Zorvanth Ice Giant 15.234 160,678 1.012 11.78 52.5 1,320.1 -40 35 Has a subsurface ocean with unique, bioluminescent marine life
Orixya Gas Giant 36.456 433,912 1.479 22.01 86.2 782.1 60 58 Has a unique "stellar nursery" region with protostars and protoplanets
Xyloren Terrestrial 6.234 31,789 7.033 11.78 51.8 437.3 570 1 Has a surface with vast, labyrinthine cave systems
Vorthex Ice Giant 15.567 170,678 1.015 11.89 54.5 1,340.1 -30 37 Has a highly active geology with frequent cryovolcanic eruptions
Oberynn Gas Giant 37.678 443,912 1.492 22.56 88.2 772.1 70 60 Has a massive storm system with aurora-like displays
Vyntrax Terrestrial 6.345 32,901 7.088 11.89 52.9 452.3 590 1 Has a surface with vast, iridescent salt flats

Link

Follow this link to the component in the GitHub repository