html word in center code example Example 1: how to center a html header h1{text-align: center;} Example 2: center text in html text-align: center;