Table without headers

What I’m trying to do

Remove the table header

Things I have tried

It was possible before using CCS:

th {
  display: none;
}

But it seems it stopped working after recent updates related to table handling. I believe with the new table system, empty header cells are not actually rendered empty anymore.

1 Like

I have used this CSS although I’m not sure how to select customization for reading mode and live preview independently:


:root {
    --table-border-color: var(--text-faint);
}

/* Border color */
.cm-s-obsidian .cm-table-widget th, 
.cm-s-obsidian .cm-table-widget td{
    border-color: var(--table-border-color);
}

/* Bold header row */
.cm-s-obsidian .cm-table-widget th {
    font-weight:normal;
}

/* Bold header row */
.markdown-preview-view th {
    font-weight:normal;
}

See CSS Editor community plugin.

Given an example note with this text we can showcase how to address this issue in two different ways:

---
Tags: f74835
cssclasses: no-table-header
---
questionUrl:: http://forum.obsidian.md/t//74835

| A beautiful    | header |
| -------------- | ------ |
| Almost as good | a row  | 

| Yet another | header #T |
| ----------- | ------ |
| The first   | row    |

We can hide all headers or just those tagged with #T. The first variant would require CSS like the following:

.no-table-header table thead {
  display: none
}

Which would render the note as:
image

In this next example I showcase the extended version where I only target the second table (which has the #T in the second header column):

.no-table-header table:has(a[href="#T"]) {
  & a[href="#T"] {
    display: none;
  }
  
  & thead {
    display: none;
  }

  & tr {
    border: 2px solid grey;
  }
} 

Which renders the tables in this note as:
image

I just added that border to that table, to showcase how this general outer CSS selector selects the table, and then you could style anything within related to this table using & ... to sub-target stuff within the table. You could of course choose whatever tag you’d want to single out the table with.

Obsidian has implemented various table‑related CSS variables.

/* table header weigth in reading mode */
.markdown-preview-view {
  --table-header-weight: normal; /* bold/normal */
}

/* table header weigth in live preview */
.markdown-source-view {
  --table-header-weight: normal; /* bold/normal */
}

Simplest solution

Plugin used : Quick Latex

$$
\begin{array}{|c|c|}
\hline
688 & 2^4 \times 43\\ \hline
512 & 2^9 \\ \hline
783 & 3^3 \times 29 \\ \hline
549 & 3^2 \times 61 \\ \hline
632 & 2^3 \times 79 \\ \hline
897 & 3^4 \times 11 \\ \hline
426 & 2 \times 3 \times 71 \\ \hline
814 & 2 \times 7^3 \\ \hline
943 & 23 \times 41 \\ \hline
357 & 3 \times 7 \times 17 \\ \hline
\end{array} 
$$

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.