# Meta Post - Common CSS Hacks

**URL:** <https://forum.obsidian.md/t/meta-post-common-css-hacks/1978>\
**Category:** Themes & CSS snippets\
**Tags:** custom-css\
**Created:** [June 16, 2020, 2:17pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978 "2020-06-16T14:17:57Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![GreenChocho](https://forum.obsidian.md/user_avatar/forum.obsidian.md/greenchocho/32/4942_2.png) [@GreenChocho](https://forum.obsidian.md/u/GreenChocho)\
**Post date:** [November 18, 2020, 2:15am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/236 "2020-11-18T02:15:11Z")

</div>

This line in the link will help you:

```auto
.cm-tag-litnotes, div:not(.CodeMirror-activeline) > .CodeMirror-line span.cm-tag-litnotes{
  color: #c7fd8b !important;
}

```

---

<div class="post-metadata">

**Author:** ![menatarp](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@menatarp](https://forum.obsidian.md/u/menatarp)\
**Post date:** [November 19, 2020, 3:51am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/237 "2020-11-19T03:51:39Z")

</div>

This _does_ help. But–funny story–when I paste this in the color change works in Edit, but no longer works in Preview! (still an improvement, though)

---

<div class="post-metadata">

**Author:** ![GreenChocho](https://forum.obsidian.md/user_avatar/forum.obsidian.md/greenchocho/32/4942_2.png) [@GreenChocho](https://forum.obsidian.md/u/GreenChocho)\
**Post date:** [November 19, 2020, 4:23am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/238 "2020-11-19T04:23:59Z")

</div>

Did you delete this part in your code?

```css
    .cm-s-obsidian span.cm-hashtag,
    a.tag {
    color: var(–accent-2);
    }

    .tag { color: var(–accent-2);
    }
    .tag[href="#litnotes"] {
    color : #c7fd8b;

```

I think this part is for preview. And the line i sent is for edit mode.  
otherwise, i have no ideas how to achieve this.

---

<div class="post-metadata">

**Author:** ![menatarp](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@menatarp](https://forum.obsidian.md/u/menatarp)\
**Post date:** [November 20, 2020, 1:27am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/239 "2020-11-20T01:27:56Z")

</div>

Didn’t delete that, but you know what? I had put your piece in between two of the other lines, but now moving it from the middle to the end of that block, the problem resolves. Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![menatarp](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@menatarp](https://forum.obsidian.md/u/menatarp)\
**Post date:** [November 26, 2020, 3:52am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/240 "2020-11-26T03:52:07Z")

</div>

Anyone know how I can change the color of text (specifically tags) inside the tag suggestion popover? Done some experimenting but haven’t found the right combobulation of code pieces.

---

<div class="post-metadata">

**Author:** ![Klaas](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Klaas](https://forum.obsidian.md/u/Klaas)\
**Post date:** [November 26, 2020, 6:53am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/241 "2020-11-26T06:53:27Z")

</div>

See [this discussion](https://forum.obsidian.md/t/theme-blue-topaz-updated-20201114-for-v0-9-14/6425/19).

---

<div class="post-metadata">

**Author:** ![frvkl](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/df705f/32.png) [@frvkl](https://forum.obsidian.md/u/frvkl)\
**Post date:** [November 28, 2020, 4:28pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/242 "2020-11-28T16:28:32Z")

</div>

Another approach would be to use CSS flexbox as such:

```
/* File Explorer Columns */
.nav-folder-children{
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
}
.nav-folder-children > .nav-folder{
	flex: 0 0 100%;
	padding: 0 1px;
}
.nav-folder-children > .nav-file{
	flex: 0 1 200px;
	padding: 0 1px;
	display: flex;
}
/* Wrap long nav text and some paddings */
.nav-file-title,
.nav-folder-title {
	white-space: normal!important;
	width: auto!important;
}
/* Indent wrapped nav text */
.nav-file-title-content {
	margin-left: 0.5em!important;
	text-indent: -0.5em!important;
	word-break: break-word;
}

```

This work well for my theme.

---

<div class="post-metadata">

**Author:** ![Metta](https://forum.obsidian.md/user_avatar/forum.obsidian.md/metta/32/89522_2.png) [@Metta](https://forum.obsidian.md/u/Metta)\
**Post date:** [November 29, 2020, 10:39pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/243 "2020-11-29T22:39:38Z")

</div>

> . . . . aren’t highlighting and boldening, as well as italicising, underlining, and using red (or colours) for the font of certain parts of text all formatting features that have been around for yonks? And we know how to implement that kind of formatting, as @Meins points out for highlighting.

@Klaas ~ Apologies for being behind the curve on this, but I’m new to Markdown, and I’m wondering:

- Where can I learn how to add colors to my fonts in Obisidian?
- Specifically, will any/all standard Markdown commands work within Obsidian, or does O use a customized version of Markdown?

FWIW, I did look in the Help file that came with my O installation, and I couldn’t find any references to font colors, even in the section on formatting notes.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Klaas](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Klaas](https://forum.obsidian.md/u/Klaas)\
**Post date:** [November 30, 2020, 3:48am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/244 "2020-11-30T03:48:56Z")

</div>

@Metta: the Help file will tell you about the features of Obsidian, and about some but not about all the basics of markdown. For example colour is not an Obs-specific feature so will not be mentioned in the Help file.

To learn about markdown you can read up about on internet, there is plenty. BTW, markdown is not difficult to learn, and once you get the hang of it you’ll love it; at least that’s how it went for me. I ditched Word and other editors and only use MD.

Another issue is that MD is in fact so simple that not everything can be done using MD syntax, such as colouring text. Nevertheless, many (most/all ?) MD “flavours” accept some inline HTML syntax too, such as colouring text.

Adding colour to your text in Obs is done as follows:  
`<font style="color:red">bla text</font>` , where “bla text” is your specific text.

It is also possible colour text and its background:  
`<font style="color:red;background-color:blue">bla text</font>`

My advice is you should create a file as you are building your knowledge about MD and basic HTML, such as font colouring.

As for your 2nd question, by “commands” I presume you mean “syntax”, i.e. MD language/flvour. The flavour Obs uses is Common Markdown.

Formatting **is** mentioned in the Help file. In the Help file click on _Start here_ at the bottom of the list in the left hand pane. On the page that opens, look under section _Quick Start_ there is a bullet point _How to use Markdown to Format your notes_, with “Format your notes” being a clickable link.

I looked at and used a number of MD apps, and Obsidian is definitely the best overall, and still evolving, quickly. It is not complete yet, but it is extremely good already.

Embrace it, enjoy it, and feel free to ask any questions, the community is very helpful with many experts. You should also join the Discord channels.

---

<div class="post-metadata">

**Author:** ![ramana](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/r/b4bc9f/32.png) [@ramana](https://forum.obsidian.md/u/ramana)\
**Post date:** [December 6, 2020, 12:30pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/245 "2020-12-06T12:30:39Z")

</div>

Hi, Thank you for this code. Its great. Just have a query:  
In the editor mode, when I write long sentences, I couldn’t get continuous lines after the text wrap (please see the following image):  
 ![obsidianquestion](https://forum.obsidian.md/uploads/default/original/2X/8/84949d1b923f18a7d7ec29a577b157c88ae34d30.png)  
However, there is no such issue in preview mode. Is there a way get continuous lines in editor mode?  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Klaas](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Klaas](https://forum.obsidian.md/u/Klaas)\
**Post date:** [December 6, 2020, 1:39pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/246 "2020-12-06T13:39:56Z")

</div>

@ramana: I don’t what code you got, but could this be what you need?

```css
/* Long bullet list: connect the same levels of bullets with vertical "lines" */
.cm-hmd-list-indent .cm-tab, ul ul { position: relative; }
.cm-hmd-list-indent .cm-tab::before, ul ul::before {
 content:'';
 border-left: 1px solid rgba(0, 122, 255, 0.25);
 position: absolute;
}

.cm-hmd-list-indent .cm-tab::before { left: 0; top: -5px; bottom: -4px; 
}

ul ul::before { left: -11px; top: 0; bottom: 0; /* change "left:" value for align of vert. line */
}

/* Edit mode unordered list dash rendered as dot for WYSIWYG */
/* I prefer "Turn -lists into bullets as you type as per Typora */
div:not(.CodeMirror-activeline)>.CodeMirror-line span.cm-formatting-list-ul {
    color: transparent;
    max-width: 10px;
}
  
div:not(.CodeMirror-activeline)>.CodeMirror-line span.cm-formatting-list-ul:after {
    content: "•";
    position: absolute;
    top: 6px;
    left: 4px;
    color: var(--text-normal);
}

```

I have a file with many useful snippets: you can download it [here](https://forum.obsidian.md/t/how-to-achieve-css-code-snippets/8474).

---

<div class="post-metadata">

**Author:** ![ramana](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/r/b4bc9f/32.png) [@ramana](https://forum.obsidian.md/u/ramana)\
**Post date:** [December 6, 2020, 2:54pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/247 "2020-12-06T14:54:05Z")

</div>

@Klaas Thank you for the reply and the code. However even with this code, I see the same gaps in the bullet lines after text wraps (please see the following image).

 ![obsidianquestion2](https://forum.obsidian.md/uploads/default/original/2X/6/689db2529f6ba4369a5673ff4c3cd4b8858fa029.png)

> I don’t what code you got, but could this be what you need?

The code posted by @lizardmenfromspace earlier.

> I have a file with many useful snippets: you can download it here

I am new to CSS and this will be very helpful. Thank you very much.

---

<div class="post-metadata">

**Author:** ![argentum](https://forum.obsidian.md/user_avatar/forum.obsidian.md/argentum/32/7733_2.png) [@argentum](https://forum.obsidian.md/u/argentum)\
**Post date:** [December 6, 2020, 5:51pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/248 "2020-12-06T17:51:36Z")

</div>

I’m going to add an answer to “How to change font styles/sizes in Obsidian?” for referencing in other threads. The contents of this snippet are from the [Minimal Theme](https://forum.obsidian.md/t/minimal-theme/3659/) by @kepano , and can be found [here](https://github.com/kepano/obsidian-minimal/blob/master/obsidian.css#L116).

```css
 /*----------------------------------------------------------------
  Font styles
  Preview mode and UI */

  --text:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  
  /* Editor mode */

  --text-editor:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  
  /* Code */

  --font-monospace:Menlo,SFMono-Regular,Consolas,"Roboto Mono",monospace;

  /* Sizes, weights, padding */

  --font-normal:16px;
  --font-small:13px;
  --font-smaller:11px;
  --font-smallest:10px;
  --normal-weight:400; /* Switch to 300 if you want thinner default text */
  --bold-weight:600; /* Switch to 700 if you want thicker bold text */
  --line-width:40rem; /* Maximum characters per line */
  --line-height:1.5;
  --max-width:87%; /* Amount of padding around the text, use 90% for narrower padding */
  --nested-padding:3.5%; /* Amount of padding for quotes and transclusions */
  --icon-muted:0.4;
  --border-width:1px;
  --border-width-alt:1px;

  /*----------------------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![mgiugliano](https://forum.obsidian.md/user_avatar/forum.obsidian.md/mgiugliano/32/7424_2.png) [@mgiugliano](https://forum.obsidian.md/u/mgiugliano)\
**Post date:** [December 8, 2020, 7:20pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/249 "2020-12-08T19:20:20Z")

</div>

> [@den](#):
>
> Enlarge image on hover

If I am not mistaken, your snippet breaks the ![[image.jpg|30]] resizing notation.  
For instance:

![[image.jpg|30]]  
![[image.jpg|100]]  
![[image.jpg|200]]

are all rendered as identical figure sizes (when not hovering with the mouse). Without your snippet, the same figured is instead rendered three times with distinct sizes.

---

<div class="post-metadata">

**Author:** ![ShaneNZ](https://forum.obsidian.md/user_avatar/forum.obsidian.md/shanenz/32/4048_2.png) [@ShaneNZ](https://forum.obsidian.md/u/ShaneNZ)\
**Post date:** [December 11, 2020, 12:33am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/250 "2020-12-11T00:33:54Z")

</div>

Regarding the visibility of the pane header icons, I use this. Keeps a tiny bit of visibility of the icons, but also keeps the pin/link items more visible even when not hovered (I find that useful). Also has a snazzy ripple of visibility in/out on hover because I was bored when I wrote it so why not? 🙂

![Untitled](https://forum.obsidian.md/uploads/default/original/2X/2/2848c023dc2a3111efecc12cffc9525e78be4493.gif)

```auto
/*
    Fade the pane header controls unless hovered (just to reduce/minimise distraction) 
    does this per individual control to easily leave link and pin slightly more visible even if not hovered, and 
    as an easy way to do a snazzy transition delay stagger in and out ;)    
*/

/* not hovered ie. on cursor exit from the header */
.view-header:not(:hover) a.view-action[aria-label*="Preview"],
.view-header:not(:hover) a.view-action[aria-label*="Edit"] { 
  opacity: 0.1;
  transition: opacity .25s ease-in-out;
  transition-delay: 0ms;
}

.view-header:not(:hover) a.view-action[aria-label*="link"] { 
  opacity: 0.55;
  transition: opacity .25s ease-in-out;
  transition-delay: 20ms;
}

.view-header:not(:hover) a.view-action[aria-label*="Pin"] { 
  opacity: 0.35;
  transition: opacity .25s ease-in-out;
  transition-delay: 40ms;
}

.view-header:not(:hover) a.view-action[aria-label*="Close"] { 
  opacity: 0.1;
  transition: opacity .25s ease-in-out;
  transition-delay: 60ms;
}

.view-header:not(:hover) a.view-action[aria-label*="More"] { 
  opacity: 0.1;
  transition: opacity .25s ease-in-out;
  transition-delay: 80ms;
}

/* hovered ie. on cursor entry to the header */
.view-header:hover a.view-action[aria-label*="Preview"],
.view-header:hover a.view-action[aria-label*="Edit"] { 
  opacity: 1;
  transition: opacity .25s ease-in-out;
  transition-delay: 0ms;
}

.view-header:hover a.view-action[aria-label*="link"] { 
  opacity: 1;
  transition: opacity .25s ease-in-out;
  transition-delay: 20ms;
}

.view-header:hover a.view-action[aria-label*="Pin"] { 
  opacity: 1;
  transition: opacity .25s ease-in-out;
  transition-delay: 40ms;
}

.view-header:hover a.view-action[aria-label*="Close"] { 
  opacity: 1;
  transition: opacity .25s ease-in-out;
  transition-delay: 60ms;
}

.view-header:hover a.view-action[aria-label*="More"] { 
  opacity: 1;
  transition: opacity .25s ease-in-out;
  transition-delay: 80ms;
}

```

---

<div class="post-metadata">

**Author:** ![GreenChocho](https://forum.obsidian.md/user_avatar/forum.obsidian.md/greenchocho/32/4942_2.png) [@GreenChocho](https://forum.obsidian.md/u/GreenChocho)\
**Post date:** [December 11, 2020, 7:16am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/251 "2020-12-11T07:16:31Z")

</div>

when i toggle this snippet, my gruvbox theme color revert back to default theme color…

---

<div class="post-metadata">

**Author:** ![ShaneNZ](https://forum.obsidian.md/user_avatar/forum.obsidian.md/shanenz/32/4048_2.png) [@ShaneNZ](https://forum.obsidian.md/u/ShaneNZ)\
**Post date:** [December 11, 2020, 9:28am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/252 "2020-12-11T09:28:10Z")

</div>

@GreenChocho That’s very odd, there’s no part of it that changes colours or affects anything like that - it should be completely theme-proof. I’ve just installed gruvbox and tested it, and I can’t recreate your issue at all. The only thing I can suggest is switching to another theme and checking that the hover behavior works, and then switching back to gruvbox (turn it off, turn it back on…)

Or maybe try pasting the code above into your snippet file again. If you didn’t get all of it (missing brace or something) then I guess it could interfere with the theme loading (can’t really see how, but you never know).

---

<div class="post-metadata">

**Author:** ![GreenChocho](https://forum.obsidian.md/user_avatar/forum.obsidian.md/greenchocho/32/4942_2.png) [@GreenChocho](https://forum.obsidian.md/u/GreenChocho)\
**Post date:** [December 11, 2020, 9:55am UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/253 "2020-12-11T09:55:56Z")

</div>

I recheck according to your comment and It was my mistake. I missed the last brace…  
I am sorry for the trouble.  
It work great now! 😃. Thank you!

---

<div class="post-metadata">

**Author:** ![ShaneNZ](https://forum.obsidian.md/user_avatar/forum.obsidian.md/shanenz/32/4048_2.png) [@ShaneNZ](https://forum.obsidian.md/u/ShaneNZ)\
**Post date:** [December 11, 2020, 6:33pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/254 "2020-12-11T18:33:23Z")

</div>

No trouble, that’s what communities are for 😀

---

<div class="post-metadata">

**Author:** ![DummyME](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/d/ba8739/32.png) [@DummyME](https://forum.obsidian.md/u/DummyME)\
**Post date:** [December 14, 2020, 8:25pm UTC](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/255 "2020-12-14T20:25:16Z")

</div>

Can someone suggest a way to change the colour and properties of italicised or bold texts? I intend to use it as an alternative to highlighting of sorts.

[Previous page](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978.md?page=10)

[Next page](https://forum.obsidian.md/t/meta-post-common-css-hacks/1978.md?page=12)
