<table>
<colgroup>
<col>
<col>
<col class="tbhighlight">
</colgroup>
<thead>
<tr class="centerness">
<th class="altern">this is my label 1</th>
<th id="tbtable">this is my other label 2</th>
<th>This is column 3</th>
</tr>
</thead>
<tbody>
<tr class="centerness">
<td class="altern">data 1</td>
/* the one below does not get styled like the first cell of this row - why? */
<td class="altern">more and more and more data 2</td>
<td> yet even more data 3</td>
</tr>
</tbody>
</table>
What am I missing? My understanding was CSS . entries could be used multiple times using class= but CSS # entries are destined to go into id= and can only be used once.
Why won’t the styling work on the second cell in the second row?
Before anyone cringes at the actual CSS styling, I’m experimenting with tables to see what I can and cannot do before I actually try to make pretty CSS tables.
The most frequently used thing for me for tables that makes existing Obsidian tables or plug-in tables other than just the CSS prettiness is the ability to use a lot of merged cells (like colspan, rowspan) to get the table look I need. But this last comment is an aside.
Thanks, I actually looked for an icon to let me see the developer view (as I’d do in Firefox). I did not know the hot keys.
Why is a directly applied CSS class less than that of the default style sheet? One would think the most closely located CSS directives would over-ride.
I don’t want to bust the existing standard CSS, but if I’m creating my own table with my own specific look, I don’t need to be falling over the default CSS.
Not sure how I can get more specific than putting a styling on it right in the table (unless you mean using a LOT of ids instead of classes or something like that). You say be more specific, but I don’t see what could be more specific than that.
it’s not what i think u think (hope that’s not confusing). css specificity is a “scoring” system that determines which get applied. see link below, scroll down mid-way.
Probably not. I have looked at a number of parts of CSS that have grown over the years and that I don’t fully 100% grasp (selectors I know to an extent, but obviously not rules of precedence or the algorithm for choosing which is priority driven).
more and more and more data 2 should be tomato coloured? Like this, without changing the CSS?
<table>
<colgroup>
<col>
<col>
<col class="tbhighlight">
</colgroup>
<thead>
<tr class="centerness">
<th class="altern">this is my label 1</th>
<th id="tbtable">this is my other label 2</th>
<th>This is column 3</th>
</tr>
</thead>
<tbody>
<tr class="centerness">
<td class="altern">data 1</td>
<td id="tbtable">more and more and more data 2</td>
<td> yet even more data 3</td>
</tr>
</tbody>
</table>
Thanks for the pointer to the whole priority algorithm.
There may be 2 lines in that whole thing I didn’t grasp, but I got the large part and it has helped me.
I still don’t know that I know how to build my own table in a graceful way (given that styling inline at the tag level in the structure is a bit ugly) but it will certainly get things done and I can try to use ids directly to pump up the priority as well if not quite as authoritatively.
I was basically looking for columns and rows that could be zebra striped as a start then some cells that might need called out if they end up holding something from a data source.
I’m very grateful for the significant knowledge you obviously have with CSS. I’m a dev, but most of my career has been under the hood, not in the UI/UX (except for a bit of Swing for some control and monitoring and some VB 6 in the windows world way back). I’m trying to come up on JS (both sides), HTML5, and CSS 3+. Each of those has a learning curve.
Yep, that’d work, though I’ve ventured off (thanks to some other responses) to finally understanding a bit more about selectors and the scoring algorithm they use to determine what styling to use if there are multiples specified at differing levels. That’s helped a lot.
I’ve been looking over the tables and their CSS and that’s helped me build a decent looking table.
One thing I’m not so sanguine about is the need to have
---
cssclass: (whatever your class is)
---
at the start of the file (below the title of the note) and what that shows is
Metadata
Cssclass tb_table
at the top of the page under the title for my note that contains the current table that I’m building.
Is there no way to hide that frontmatter stuff so those looking at the content of the note don’t have to see that? Even if you could stick it at the bottom of the note it’d be an improvement.
Besides turning off showing of the entire frontmatter, the post below shows some alternatives to either show tags and/or aliases, and/or also include the rest. Maybe you could adjust this to your liking?
I am very appreciative of the the people willing to answer questions and that have answers (or know where the answers live).
I know frontmatter is a YAML thing and there are Obsidian-aware tags and aliases, but I haven’t started with either of those features (I love tagging generally, but I have to learn how it is done and what it really does in Obsidian).
Seems like Obsidian has many ways to be used and that makes it at times hard to see (without an example of your own) what a feature is meant to do and how it is meant to use it effectively.
My purpose is to have a plain-text, fairly contained, linked text collection. Lots of other people seem to do stuff with integrations with other external tools/platforms, do scheduling, daily journaling, priority management, etc. I’m sure there are other uses.
The bit of CSS that I got from the linked article made the unsightly frontmatter go away. VICTORY!