Center text for selected notes (Poetry collection) [CSS]

I deleted my earlier post because I suggested using <center></center>. I saw that has been deprecated. The following works for me:

  1. Create and activate a css snippet:

    /*style to center text; activated by <p class="center">text</p> */
    .center {
     text-align: center;
    }
    
  2. 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.”

  3. Move “your template” into your Templater folder.

  4. Then, to center text: (a) select all the text that you want to center; and (b) open the Command pallet (⌘ P), find and click on “Templater: Insert Template,” © click on “your template” from the pop up (you can set up a hotkey for this). All the text you selected should then be centered.

  5. You might have to quit/restart Obsidian to get this all to work.