I want to center all texts in note of my poetry collection. It is only selected files not whole poetry vault.
I tried to add:
<body class="poetry">POEM TEXTS</body>>
& in CSS I defined body.poetry{text-align =center}>
But for some reason the Obsidian ignores the body tag and text is aligned by default to left.
Do you have another idea how to center all text in specific note, without doing it manualy for each verse? Take in cosideration that I don’t want to create new Vault with all text aligned in center.
Because I want all text inside the note should be centered. When I tried <div> or <spans> the poems lose all line-breaks, so it was big continuous mash of text, or it will just center after first line-break and all rest ignore the center alignment.
Yes, this has to do with the markdown rendering processes of Obsidian. Feel free to submit a feature request for “Recognize line breaks within custom HTML elements” or similar.
But using <br /> is the only way this will work for now, as far as I can tell.
Hm. Make sure you copy+paste my text above exactly. (There are two spaces after the image line, and a blank line between the statements.) Otherwise, try turning strict line breaks on…
My guess is that markdown is not treating the two separate lines as separate paragraphs, causing odd behaviour.
I am so new to this forum that I didn’t know that you responded until now. I will use your suggestion and retry. In the meantime, I have turned on notifications.
And thank you Ryan!
I’m having the same problem as @dducoff, right now (v0.12.3, macOS 11.4). Without any non-space character right before the <div class=… stuff, the link inside the <div> … </div> is not parsed.
I deleted my earlier post because I suggested using <center></center>. I saw that has been deprecated. The following works for me:
Create and activate a css snippet:
/*style to center text; activated by <p class="center">text</p> */
.center {
text-align: center;
}
Create a Templater (a Community plugin) template by opening a new Note, and typing the following as the Note’s content: <p class="center"><% tp.file.selection ( ) %></p> Choose a title for the Note like “center text.” This is “your template.”