I’ve been experimenting with HTML embedded in Notes to help make things more organized and clean looking as part of my code fence replacement plugin, but when I drop the w3.css snippet in the snippets folder, I notice that EVERYTHING in Obsidian slightly changes and either breaks some things or causes text to run off the screen and such. However, once disabled, everything resets.
Has anyone tried this before? Has anyone had this issue before?
Obsidian is a markdown note taking app, not a code editor. It does support HTML in your notes and CSS adjusted for use in Obsidian, but you can’t drop an entire webpage template in a note. Well, you can, but you’ll get some weird results.
What you’re looking for is to open and edit those templates in a code editor and view the results in a web browser.
Sure, you are correct. I was using HTML in Obsidian to make structured formats of data within a note. Without the w3.css snippet enabled, all the formatting is removed from that HTML. I can do a lot of the same thing using an HTML Table and some CSS via style=“” attributes.
Is there a way to include something like w3.css in a Theme plugin and conditionally enable it?
I see. Sure, you could clip sections of the w3.css, paste them into your own .css file, and make the necessary CSS adjustments to work in Obsidian and with whatever theme you are using.
For example, with a quick look, the w3 HTML examples of:
<div class="w3-container">
<p>A car is a wheeled, self-powered motor vehicle used for transportation.</p>
</div>
<p class="w3-large">The Catering was founded in blabla by Mr. Smith in lorem ipsum dolor sit amet, consectetur ... We only use <span class="w3-tag w3-light-grey">seasonal</span> ingredients.</p>
However, there may be cases where the CSS in the w3 file doesn’t translate to Obsidian’s CSS so will need to be adjusted. I’m guessing that’s where you are seeing the breaking or strangeness.