Thank you for sharing

@Lithou: my 1st reaction: thanks a lot. :+1:

Update: I just watched the video. Absolutely amazing. You should mention this in the #css-themes channel on Discord !! I will also add it to my public code snippets file at the top of this page.

Even resident CSS guru (:grinning_face_with_smiling_eyes:) @death.au will probably be impressed with your code.

I want to thank you for that video, which is a very good presentation, you speak clearly and at the right speed, and explain the various CSS elements well. I am truly impressed!

Don’t forget the #css-themes channel.

1 Like

This is marvellous @Lithou, thankyou so much. I have called up an iFrame with the #portrait snippet, and I now have a clock (onliveclock.com) always in the corner of my (admittedly preview only) window as I scroll up and down. Love it!

1 Like

even resident CSS guru (:grinning_face_with_smiling_eyes:) @death.au will probably be impressed.

Yep. This is some good stuff! Using suffixes on links and targeting them specifically is genius!

Also, I found a way to get around your blockref problem for the Side-bar Quote Snippet. Change [src$="-sbq"] to [alt="sbq"] and use the pipe syntax to specify that alt (e.g. ![[I am freeman#^234f1c|sbq]]).
Interestingly, exactly the same thing (pipe syntax / alt) works for images too.

I have added code for coloring italic and bold font in Edit and Preview modes - see section “Fonts” in the file.

I have also registered Lithou’s amazing code for oval images, call-outs, images in sidebar. I have listed it under “Special effects” in the file.

You’ll find all this in version 20 of the file in the OP above.

1 Like

Background Images from Local files:


So… Lithou is avoiding studying for finals… which means cool CSS stuff!


How to do it:

  1. Embed an image into a document
  2. Make sure preview mode is visible
  3. Open up the developers tools
  4. Find that image in the elements list
  5. Click on “Properties” tab then expand the first item “img”
  6. There will be an absolute file path listed after "src: “path goes here”
  7. Copy/paste that path into your css as a background-image

Here is an example:

Endless Possibilities:

  • You can use the background in general such as preview mode/edit mode.
  • You can use it for preview mode on pages with a certain cssclass in their meta data
  • you can use it on other elements of obsidian.
    • Want to make a divider bar look like wood?
    • Want to make your title bar look like some diamond plate?
    • How about combining two backgrounds for a cool stylized parchment effect?
    • Want to do all at the same time so it clashes horribly?

Go right ahead I’m not here to tell you how to live your life. :slight_smile:

Future / Coming Soon:

Putting together some of the psuedo class stuff (thanks to @death.au and some others on discord/forums) and some bg stuff and a few other random items. Still super buggy and working on a few CSS odities, but here’s a preview. Will update with snippets to add to @Klaas 's list when stable.

9 Likes

@Lithou: it seems this guru cannot be held back either :joy:
Any chance to make some of this incredible stuff into (a) plug-in(s)?

Yes, I also designed a CSS style from your interesting approach


When you click on the “I”, it will show you the hidden thing

I feel interesting as a CSS novice :yum:

2 Likes

@Rainbow_CH: very nice. Useful for a question & answer session.

Weird… all this stuff has stopped working in my Obsidian. I don’t think I have changed anything, just turned my machine off last night, and turned it on today. All the positioning commands have stopped working. I’ve tried all the obvious stuff (restarting Obs, restarting my machine, turning off and restarting the snippets, changing the ‘float’, and positioning measurements)… Nothing. This is a little heart-breaking
Can you suggest anything I have missed?

I tracked down the source of the problem - the ‘active-line highlight’ snip that @mano put on Discord. Not sure what in there specifically did it, but I can live without it; the floating images and quotes are much more important to me.

The Problem of Perfection

I love tinkering around with things and experimenting with CSS brings me lots of excitement and joy. I like sharing cool ideas I’ve had or promising discoveries. When I share something, others will have incredible improvements or creative uses for my ideas that I never would have thought of on my own.

The problem is that when someone asks how I did something or asks for a CSS snippet, I don’t want to share it because an idea is just that, an idea. It isn’t robust, it isn’t complete, it isn’t polished. I’m also a socially prescribed perfectionist so I often will say “You will have to wait”

Opening Up the Garage Door

The truth is, no idea comes fully formed, no project is ever complete. Even though things may be unfinished, unpolished, and incredibly messy, they still benefit from collaboration and questions (especially in this community where people are so helpful and constructive).

I’ve decided that in this I want to “work with the garage door up” to borrow a phrase. I created and uploaded a sandbox vault into a git repository. This is the vault that I will use for tinkering around with CSS, trying to reproduce bugs and other behaviour, and writing plugins if/when I get to that point. I just started to solidify my notes and CSS snippets so you won’t find everything there just yet, but you will find the CSS that I used for the page layout.

Inside the Garage

Just like any workspace there will be tools and projects lying around in various stages of completion. However, I hope that you will find insight, help, or simply have fun peaking over my shoulder to ask “what ya’ doin there?” I am hoping this will slowly help combat my unhealthy levels of socially prescribed perfectionism and provide a bit of accountability for me to not procrastinate some basic organization along the way.

Feel free to comment, clone, fork, create pull requests, etc. Ask questions here or on the discord. All those things. If you’d like to join me, send me a message and we can look at setting up some branches for various projects to collaborate on. Thanks for letting me share.

Go have fun: https://github.com/Lithou/Sandbox

2 Likes

Blowing my mind. This is so generous. Onward noble knight!

1 Like

All the code in the file has now been put on Github, courtesy of StreLock. You can view or download the file here. If you have a Github account you can add interesting code too.

Today I added some more amazing code from Gabroel: sticky notes, and images with a scotch tape effect.

You can find this code under the heading “Special effects”. Enjoy.

Note: I will continue informing people of new additions to the Github file via this Obsidian forum page.

1 Like

I added code for a touch of extra reality to the tape (thank you @Lithou): 2 serrated edges.

yeah, use my stuff with caution. I don’t know what I am doing - I am just messing around :). The active line stuff also highlights any --- section separator stuff for some reason.

I’ve saved it as a snippet and only turn it on when needed.

Super useful, Klaas. Thank you for putting in such a good effort. I have a question about the Mermaid styles. Are these supposed to be used inline or in the snippets file?

@cestvrai: inline. Some of the themes have mermaid styling integrated in their css files, but you can use the code from my file in any case.

@Klaas, do you happen to know which themes incorporate mermaid style? I know the Minimal theme does not, and inline styling does not work in Obsidian as far as my limited CSS knowledge can tell. You have to use CSS.

@cestvrai: Obuntu is an example, but there are a number of others, I have not looked at all the available themes.

The mermaid code in my file is not CSS code, it is mermaid code to achieve hierarchical trees like e.g. org charts. Mermaid code is much broader than that.

The mermaid code in my file is for use directly in an Obsidian note, the styling is standard mermaid styling. I think that a theme that incorporates mermaid in its CSS is just for styling of e.g. boxes, like round instead of square. Remember, CSS is just a styling code. If you think of a house as an analogous concept, then HTML is like the structure, CSS is the wallpaper, and JavaScript is what puts things in action like the electricity in a house does.

You’d be better off talking to the theme dev about the mermaid part of the CSS sheet.

1 Like