Meta Post - Common CSS Hacks

Right. No prob. Yes, in my line of work I share my screen quite often, including recorded sessions, so some sensitive information is better be a bit more protected from unintentional exposure.

BTW, talking about unintentional exposure: I use this slightly modified version of the same snippet, which delays un-blurring, so one wouldn’t uncover the “secret line” immediately on mouse hover when, let’s say, just scrolling or passing by with one’s cursor:

[data-task="#"] {
  filter: blur(8px);
  -webkit-filter: blur(8px);
}

[data-task="#"]:hover {
  transition-delay: 5s;
  filter: none;
  -webkit-filter: none;
}

[data-task="#"] {
  transition: 0s filter;
}

Playing with those two additional numbers you can set up the overall delay (5s in this example) of the effect (0s in this case), or set the time it takes for the text to fully come into focus. Hope this further improvement can be helpful.

Hi Everyone,

Does this still work (clean-embeds-all), or am I wanting something different?

I followed the video to use clean-embeds.all.css (https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/411) and am confident that it is updating Obsidian (I tried another version that prevents the indenting of text and I can see it move when I enable/disable the CSS snippet.

I am wanting to embed using ![[File Name#Heading Name]] and have the contents within that heading displayed - without the heading… but the heading still appears.

What am I doing wrong?

Thanks,

Russell

That snippet is from May '21. There have been a lot of changes in Obsidian since then.

I’d give Embed Adjustments - SlRvb's Documentation - Obsidian Publish a try for lots of options per embed or kraxen72’s clean embeds snippet: [feat] clean embeds.css · main · clown shoes / obsidian-snippets · GitLab to cover everything universally.

Thank you so much Ariehen,

SIRvb has me a bit scared - info overload, but I’ll try to work through it.

Kraxen 72’s looks great - but didn’t work for me “out of the box”… I’m wondering if what I’m expecting just isn’t what others are solving. I was expecting the CSS to include the word “Heading”, but it doesn’t - so maybe no one else is trying to hide the heading?

I will keep working on this. :slight_smile:

Thanks again,

Russell

Apologies, kraxen72’s snippet doesn’t appear to take care of the headings. I thought it did. :bowing_man: It’s still nice though. I used it for a long time.

To remove all headings in embeds universally without adding any alt/attribute text ( ![[File Name#Heading Name|no-h1]], etc.) like in SlRvb’s snippet, you could try this:

.internal-embed :is(h1,h2,h3,h4,h5,h6) {
    display: none;
}
3 Likes

Ariehen,

That was perfect! Thank you!

Russell

Hello,

[This is an edit, I asked this improperly earlier, sorry].

Could anyone point me to possible css snippets to increase/restore the spacing in between a heading and the first paragraph within an embed note (without changing the heading spacing)? The theme I’m using (obsidian gruvbox) will omit any line break just below a heding within an embed.

I’ve tried @ariehen suggestions above, also the older clean-embeds(-all).css snippet.

Thank you and good evening

Finally find a way to change Tags in edit mode:

.markdown-source-view.mod-cm6 .cm-hashtag {
  color : blue;
}

#sharingiscaring

1 Like

First, a big thank you for sharing such useful information, and documenting it so professionally!

Unfortunately (and I admit, I’m very new to Obsidian), I can’t get it to work. At all. So it must be me. I’ve got the file, it’s “identified” in Obsidian, enabled, Obsidian was restarted, and still I still have (for example) the left purple line that shows content as embedded. Do I miss something to really have embedded content show as if it would be content from the same file?

Thanks again


Capture d’écran 2023-11-26 à 10.21.16

The CSS in the screenshot there is for hiding the link icon in Reading view. Give this a try to remove the left embed border for both Editing and Reading views:

body {
    --embed-border-left: unset;
}

Shrink Pinned Tabs

v1.4+ compatible

.workspace-tab-header:has(.mod-pinned) {
  /* shrink if pinned */
  max-width: 60px !important;

  /* also hide the title of pinned tabs */
  & .workspace-tab-header-inner-title {
    display: none;
  }
}

Result:

Screenshot-25_11_2023-22.48.26

NOTE: there is still a tooltip with the title being shown if you hover the shrunk tab, and unpinning reverts the tab just as expected :kissing_smiling_eyes: :ok_hand:

P.S. this is based on a recent feature request, and honestly I am surprised this wasn’t the default design of Obsidian UI:

Thank you so much ariehen !

Is there a way I can decrease the indent on my list, so that I waste as less space as possible on the left?

Maybe some kind of “text-indent: -5px”, but probably not in the body, but in table cells? I’ve tried it within “.markdown-embed:” but without success.

Thanks again

Without having the source Markdown to work with it’s a bit of guesswork, but going off your screenshot, but it looks like a (a) table with an (b) ![[embedded note]] containing a (c) list.

You could try some combination of these (adjusting the values as desired) to see if the spacing looks any better for you.

/* all embeds - padding (top-right-bottom-left) */
.markdown-embed {
    padding: 0 0 0 10px;
}

/* rendered list indentation */
.markdown-rendered ul, .markdown-rendered ol {
    padding-inline-start: 1.2em;
}

/* rendered list indentation in tables only */
.markdown-rendered th :is(ul, ol) {
    padding-inline-start: 1.2em;
}
1 Like

Thanks a lot!

@Brenzle It’s a lonnngggg and winding topic.

Check out [feat] clean embeds.css · main · clown shoes / obsidian-snippets · GitLab and Embed Adjustments - SlRvb's Documentation - Obsidian Publish

They should both work on desktop and mobile at the moment.

Hello!

First post in this glorious forum. Big thank you to @Moonbase59 for creating the awesome CSS-Hack, which isn’t as much a hack than a full feature! (Original Post Here)

And also thank you to @awholelottasomething that asked the question I was asking in my head.

And lastly to you @zerkshop who made the effort to explain!

Now to the problem I saw

When following your instructions, I had some issues when trying to work with my notes. I couldn’t create any new lines underneath what I’ve already written. No matter how many times I pressed “return” or “shift+return”. Hmm… Thats weird I thought and I realized it was only apparent when I had “clean-embeds” on.

The reason was these lines, and I specificly want to point towards the “.markdown-preview-section” parts. Removing this here would introduce the “weird” behaviour.

/* remove <br> between internal embeds */
.clean-embeds .markdown-preview-section div > br {
  display: none;
}


/* remove vertical space added by markdown-preview-sizer */
.clean-embeds div.markdown-preview-sizer.markdown-preview-section {
  min-height: unset !important;
  padding-bottom: 0 !important;
}

Removing the ".markdown-preview-view " to “” (empty string) here would introduce a lot of weird states where we cant have a new line or

But I’ve re-added it there so now that behaviour is only in the preview view, where we do not need to edit our files!

Hope this helps someone in the future!

Hi, for some reason I can’t get this to work. I tried both the code for all embeds and the code for cssclass, but neither seemed to work. Is it me or maybe something has changed this code was posted?

Obsidian’s default theme has been redesigned since then.

Does anyone know if it’s possible to style the bullets of a list differently according to the use of the symbols -, +, and * using just CSS?

I don’t remember but it’s been asked before, so searching here or on Discord may find an answer.