Properties CSS - Note Icons and Custom Titles!

With this CSS snippet, you can define an icon and a display title for your notes! It also causes tags to float under the title, Make.md style.

How to Use

  • To define an icon, just make a property called icon and give it a value of an emoji or unicode character. Like this (quotes are optional):
---
icon: "⚙️"
---
  • To give your note a display title, make a property called title.
---
title: "This is an Alternate Title!"
---
  • Having a tags property automatically gives you the nice tags-under-title look.

Get the Snippet!

Copy and paste into .obsidian/snippets in your vault!

body {
  --tag-addition: 0px;
}
/* get rid of property keys for our custom properties */
[data-property-key=icon i] .metadata-property-key, [data-property-key=title i] .metadata-property-key, [data-property-key=tags i] .metadata-property-key {
  display: none;
}

/* === make properties display-able always (so icons and such don't disappear when collapsed) === */
.metadata-content {
  display: unset !important;
}
.metadata-container.is-collapsed .metadata-add-button.text-icon-button {
  display : none !important;
}

/* === Icons === */

/* put icons in a position relative to inline title */
/* also responds to inline title size (may break at high sizes)*/
[data-property-key=icon i]{
  position: absolute;
  display: block !important;
  margin-top: calc(calc(-130px - var(--tag-addition)) - calc(var(--inline-title-size) / 2)) !important;
  z-index: 300!important;
  padding: 0px;
  height: fit-content;
  font-size: calc(var(--inline-title-size) * 1.3);
  left: 0;
}


/* make some room above the inline title */
[data-type=markdown]:has([data-property-key=tags i]) .inline-title {
  margin-bottom: calc(20px + var(--tag-addition)) !important;
}
[data-type=markdown]:has([data-property-key=icon i]) .inline-title{
  margin-top: calc(calc(70px + var(--tag-addition)) + calc(var(--inline-title-size) / 8)) !important;
  font-size: var(--inline-title-size) !important;
  text-align: left !important;

}

/* ==== Custom Titles ==== */
[data-type=markdown]:has([data-property-key=title i]) .inline-title {
  opacity: 0; /* make the REAL title disappear! */
}
[data-property-key=title i]{
  position: absolute;
  display: block !important;
  margin-top: calc(calc(-70px - var(--tag-addition)) - calc(var(--inline-title-size) / 2)) !important;
  z-index: 300 !important;
  padding: 0px !important;
  margin-left: 0 !important;
  height: fit-content;
  left: 0;
  font-weight: var(--inline-title-weight);
  font-size: calc(var(--inline-title-size) + 0.3em) !important;
  line-height: var(--inline-title-line-height) !important;
  font-style: var(--inline-title-style) !important;
  font-variant: var(--inline-title-variant);
  font-family: var(--inline-title-font) !important;
  letter-spacing: -0.015em !important;
  color: var(--inline-title-color) !important;
}
[data-property-key=title i] .metadata-input-longtext {
  padding: 0;
  overflow: hidden;
  width: var(--file-line-width);
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}

/* ==== Pretty Tags ==== */
[data-property-key=tags i]{
  position: absolute;
  display: block !important;
  margin-top: calc(-60px - calc(var(--inline-title-size) / 2)) !important;
  z-index: 300!important;
  padding: 0px;
  height: fit-content;
  left: 0; 
  
}
[data-type=markdown]:has([data-property-key=tags i]) {
--tag-addition: 20px;
}
[data-property-key=tags i] .multi-select-container {
  padding: 0;
}
[data-property-key=tags i]:hover {
    box-shadow: none;
}


12 Likes

So amazing! The tags floating below the title is a great feature.

Glad it could be of use to you.

Hey thanks for this! This is the closest script I’ve found that does what I want to do, so I was trying to modify it a bit, maybe you could assist, or know whether what I’m trying is even possible?

I’m trying to import my bookmarks into Obsidian, and so they also have an icon.

However the icons would be formatted like this:

---
icon_uri: https://static.licdn.com/sc/h/al2o9zrvru7aqj8e1x2rzsrca
icon_data: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABx0lEQVRYR2NkGGDAOMD2M8Ad0LD7tkXDzhtLGP7/V6apoxgZ7za4a8Q0uKqeANmDCIGSzXdobjnMZ0BHMPT4qqA6oHjTf5r6HN3wXj+w5xEhgOYAD3VRhnRLBbC2mccfMOy4+Zq67sPnAJDl21MtUCz0nH2Cuo7A54D1CaYMAToSKA7YcOUFQ+CC09QLhUHtgAGPAlA4D2giJDeiFQQ5GUS42RjefP3F8OTjD4Y///DkbELZ8H+PL4o7GEs2g/nI4gfuvmUA5Y5yJxWGHGtFsOUw8OP3X4YVF54xVG67zvDi809MP1HDAWcef2D48ecvg42iMM5Au/HqC4PlpMMMH378QVVDDQcQG1U1228wtO69TVsHgOL9y88/4GjgYWdBsezC048Mhv2HaOOAP//+MaSuusiw4MwTsAUCHCwM6xNNGRyUReAWgtSwlm2ljQMmHL7HULjxKorhLqoiDLvTLbEmYrggtdIAKIGdePQBxTJQdrxf7UIfByi27mF48P47imWgaHjf4kkfB8DKB/QcgascoXoUjDpgNARoFgLElvNkqyNUEJFtMLEaMRww0B0TenbN9mdaRDgqi54BBdbg6ZwSG3XUVgcAjS5CMHxzQJgAAAAASUVORK5CYII=
---

So in plain html you’d be able to show the icon by just putting the icon_data into an img src tag.

Would it be possible to display an image based icon like that, with some slight modification to your css snippet?

I’m not sure; I’d have to think about it some more. Honestly, I have barely used Obsidian and haven’t really touched CSS in almost a year now, I think. Right now I’m thinking, from what I remember, no I don’t think that is possible with CSS alone. But I’ll play around and find out.