The CSS Table Generator styles data tables with a clean, consistent look: a coloured header row, bordered cells, comfortable padding, and optional striped rows that help the eye track across wide tables. Tables carry some of the most important content on the web, from pricing comparisons and schedules to statistics and product specifications, yet unstyled tables look flat and are hard to scan. A few well-chosen rules transform them into readable, professional displays.
This tool lets you design the table style visually before writing any CSS. Choose the number of rows and columns for the preview, decide whether to include a header row and striped rows, pick a border style and colours, and set the cell padding. The preview table updates instantly with placeholder headers and cells, and the CSS panel shows a .styled-table rule set that you can copy and apply to your own table markup.
What Is the CSS Table Generator?
The CSS Table Generator is a visual editor for table styling. It generates CSS for a table with the class styled-table, covering the table width and border collapsing, the cell borders, padding, and alignment, an optional header style, and an optional striped-row style. The preview table is built from the row and column counts you enter, with headers labelled Header 1, Header 2, and so on, and body cells labelled with their row and cell numbers.
Rows can be set from 1 to 10 and columns from 1 to 6. The header row checkbox controls whether a thead section with header cells is shown, and whether the header rule appears in the output. The striped rows checkbox controls whether even body rows get a light tint, and whether the striped rule appears in the output. The border style dropdown offers solid, dashed, dotted, double, and none, and the border is always 1 pixel wide in the generated code.
The colour controls cover the border colour, the header background, and the header text colour. The default border is a light grey, the default header is a deep green background with white text, and the default cell padding is 10 pixels, adjustable from 2 to 24. The striped tint is a fixed pale colour applied to even rows in the table body. The table always uses full width and collapsed borders, and cell text is aligned to the left.
- Row and column controls: number inputs from 1 to 10 rows and 1 to 6 columns for the preview.
- Header and stripe toggles: checkboxes that add or remove the header row and the striped-row styling.
- Border controls: a style dropdown and a colour picker, with a fixed 1 pixel width.
- Header colours: separate pickers for the header background and header text.
- Padding control: a slider from 2 to 24 pixels for cell padding.
How to Use the CSS Table Generator
Design for your real data. A pricing table with three columns needs different padding and striping than a dense schedule with six columns.
- Set the rows and columns. Enter the number of body rows, from 1 to 10, and the number of columns, from 1 to 6. The preview table redraws with placeholder cells so you can judge the proportions of a table that size.
- Decide on a header row. Leave the Header row checkbox ticked to include a thead with styled header cells, or clear it for a table without headers. When cleared, the header rule is omitted from the output.
- Decide on striped rows. Leave the Striped rows checkbox ticked to tint even body rows, or clear it for a uniform table. Striping helps most in wide tables with many rows, where the eye must track horizontally.
- Choose the border style and colour. Use the Border style dropdown to select solid, dashed, dotted, double, or none, and the Border color picker for the border colour. A light grey solid border is the safest default for data tables.
- Pick the header colours. Use the Header background and Header text color pickers. A dark background with white text makes the header row stand out as a label for the columns below it. Check the contrast of the combination.
- Set the cell padding. Drag the Cell padding slider between 2 and 24 pixels. More padding makes a table feel spacious and easier to read, while less padding fits more data in the same space. Ten pixels is a balanced default.
- Copy the CSS. Click Copy CSS to copy the .styled-table rules. Paste them into your stylesheet and add the styled-table class to your table element. The preview data is placeholder text; your own table markup supplies the real content.
Key Features of the CSS Table Generator
The tool generates a complete, conventional table style with no unnecessary properties, so the result is easy to understand and safe to combine with other styles.
- Full-width collapsed table: the base rule sets width to 100 percent and border-collapse to collapse, so adjacent cell borders merge into single lines.
- Shared cell rule: header and data cells share one rule for border, padding, and left alignment, which keeps the output short and consistent.
- Conditional header rule: the header background and colour rule appears only when the header row is enabled, so disabled features leave no dead code.
- Even-row striping: the striped rule uses the nth-child(even) selector on body rows, which is the standard way to stripe a table without adding classes to each row.
- Live placeholder preview: the preview shows real table markup with headers, body rows, and cells, so the style is judged on a genuine table structure.
- Five border styles: solid, dashed, dotted, double, and none cover the common table border treatments in one dropdown.
Practical Use Cases
Tables are for data that belongs in rows and columns. The examples below show the tables that benefit most from this styling.
Pricing comparisons
A pricing table compares plans across columns, with features down the rows. A strong header row labels each plan, generous padding keeps the features readable, and striping helps the eye follow a feature across plans. Use three or four columns for most pricing tables.
Schedules and timetables
Class schedules, event agendas, and shift rotas are tables by nature. A header row labels the days or times, and striped rows help readers track a time slot across the week. Keep padding moderate so a full week fits on one screen without excessive scrolling.
Product specifications
Specification tables list attributes and values, often in two columns. A header row may be unnecessary here, so clearing the header option and using striping alone can give a cleaner result. Left-aligned text suits specification values that vary in length.
Statistics and reports
Reports with numbers benefit from consistent borders and padding that align digits into readable columns. Striping is especially helpful when a report has many rows, because it prevents the eye from slipping to the wrong row mid-line.
Comparison and feature matrices
A feature matrix shows which options include which features, with checkmarks or short values in the cells. A coloured header, clear borders, and even striping make the matrix scannable, so readers can compare options column by column.
Tips and Best Practices
Readable tables depend on structure as much as style. Keep the data honest and the styling quiet.
- Use real table markup: use table, thead, tbody, th, and td elements for tabular data. Do not build a data table from div elements, because assistive technology relies on table semantics.
- Keep headers short: header cells should label the column in a few words. Long headers force narrow columns and awkward wrapping.
- Do not over-stripe: a pale stripe is enough. A strong stripe colour competes with the data and makes the table look busy.
- Align numbers consistently: this tool left-aligns all cells. If your table is mostly numbers, consider right-aligning numeric columns in your own stylesheet for easier comparison.
- Plan for narrow screens: wide tables overflow small screens. In your own code, wrap the table in a scrolling container or simplify the columns for mobile, because this tool does not generate responsive behaviour.
- Test with real content: placeholder cells are uniform, but real data has long names, large numbers, and empty cells. Check the style with your actual table before publishing.
Limitations
This generator styles a table with one uniform border width of 1 pixel, one padding value for all cells, and left alignment for all cells. It does not support different padding per column, centred or right-aligned columns, column widths, caption styling, footer rows, row hover effects, sticky headers, or responsive collapsing. The striped tint is a fixed pale colour that cannot be changed in the tool.
The output is CSS only. It does not generate the table markup, and the row and column counts affect only the preview, not the generated rules. The generated rules apply to any table with the styled-table class, regardless of how many rows and columns it contains. You must write or provide the HTML table yourself, or generate it with a separate HTML tool.
- Fixed 1 pixel border width and one padding value.
- Left alignment only; no per-column alignment or widths.
- Fixed stripe colour; no hover, footer, or sticky header rules.
- CSS only; table markup must be supplied separately.
Frequently Asked Questions
Does the row and column count affect the copied CSS?
No. The counts control only the preview table, so you can judge the style at a realistic size. The generated CSS uses selectors that apply to any number of rows and columns, so the same rules style a three-row table and a thirty-row table.
Why does the header rule disappear when I clear the header checkbox?
The generator includes the header rule only when the header row is enabled, and the striped rule only when striping is enabled. This keeps the output free of rules for features you are not using. Re-tick the checkbox to bring the rule back.
Can I change the stripe colour?
Not in this tool. The striped rule uses a fixed pale colour. To use a different tint, edit the background-color value in the copied nth-child rule by hand, choosing a pale colour that contrasts gently with the white rows.
How do I apply the style to my table?
Paste the copied CSS into your stylesheet, then add the class styled-table to your table element. Make sure your table uses thead for the header row and tbody for the body rows, because the striped rule targets body rows specifically.
What does border-collapse do?
Border-collapse set to collapse merges the borders of adjacent cells into single lines, so the table shows one clean grid instead of doubled borders with gaps. It is the standard setting for styled data tables and is included in the base rule generated here.
Tables, Accessibility, and Screen Readers
A table is not only a visual arrangement; it is a semantic structure that assistive technology uses to explain data to readers who cannot see the grid. When a screen reader encounters a properly marked-up table, it can announce the header for each cell as the reader moves through the rows, so a number is never heard without its context. That behaviour depends on the markup, not on the CSS generated by the CSS Table Generator: the table needs thead and th elements for headers, tbody for the body, and a scope or header association that tells the reader which header belongs to which cell.
The styling choices in this tool support that semantic structure rather than replacing it. A visually distinct header row, with a dark background and light text, tells sighted readers exactly what the th elements tell screen reader users: these cells label the columns. Striped rows help sighted readers track across a wide table, which is the visual equivalent of the header announcement that screen readers provide automatically. Keeping the visual and semantic structures aligned, so that the styled header row and the markup header row are the same row, is what makes a table work for everyone.
Two common table mistakes deserve mention. The first is using a table for layout, arranging navigation or page sections in table cells, which confuses screen readers that announce layout tables as data. Layout belongs in flexbox or grid, and tables belong to data. The second is building a data display from div elements styled to look like a table, which looks right but conveys no table semantics at all. If the content is genuinely tabular, with rows and columns that mean something together, use a real table element and style it with the rules from this tool. The result will look professional and behave correctly for every reader.
Related Tools
These tools cover table markup, grid layouts, and form styling that often accompany tables.
- HTML Table Generator – generate the table markup to pair with this CSS.
- CSS Grid Generator – build grid layouts for content that is not tabular data.
- CSS Form Generator – style forms that collect the data tables display.
- CSS Border Radius Generator – round the corners of cards that contain tables.
- Color Picker – choose header and border colours that match your palette.