Home > Software engineering >  Is there a CSS-only solution to creating a scrollable table body that is full width?
Is there a CSS-only solution to creating a scrollable table body that is full width?

Time:11-22

Using Tailwind, I am having trouble creating a table with a scrollable body that spans the full width. Currently the way I'm doing it is by setting the tbody to display: block but by doing that the tbody isn't the full width. How can I go about making it full width? I want the table body to be scrollable separately from the rest of the page.

Tailwind Playground

CodePudding user response:

Add overflow-auto class to your table.

CodePudding user response:

I just removed the class block from the table and it's working now as expected

Tailwind Playground

CodePudding user response:

After removing block class from the tbody and adding

<thead >

You get a separate scroll for your body of your table
Tailwind Play

  • Related