Indent paragraphs that start with tags

Hello,

Does anyone know how to customise the CSS to indent paragraphs that start with a tag?

Many thanks!
Tian

Hmm, this is an interesting request. You can target tags with .tag. You could do something like this:

.tag {
  position: absolute;
  left: 50px;
}

But the problem with the left property is that it is not going to be relative to the paragraph, it’s going to be relative to the section container, which spans the width of the pane. So the tag will move as the pane width changes.

I’m also not sure whether you want to apply this to all tags or just the first tag of a section, so you might need your rule to be something like .markdown-preview-section > p > .tag. There are other ways to target that first tag.

If you want to continue with Obsidian and custom css, I recommend reviewing this post https://forum.obsidian.md/t/getting-comfortable-with-obsidian-css/133 and other resources on the forum and in the help vault.

Thanks - they’re great starting points.

After doing some googling, I think I need has() selector, which is scheduled for CSS 4. With it, I can select the paragraphs containing tags and do a combination of left (for tag) and right (for p).

In the meanwhile, is there a way to instead change the formatting (e.g. font weight) of a paragraph which starts with a tag? (I’m trying to get paragraphs tagged as “note” to stand out from the other paragraphs).

Same problem. There’s no way for a paragraph to know it starts with a tag.