#+TITLE: Hello World
#+AUTHOR: A. U. Thor
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>

currently gives me this as output where the title is centered to the left.

enter image description here

  • 1
    In your style.css add .title {text-align: center;}. Classes used when exporting are documented in the org manual: orgmode.org/manual/CSS-support.html. This might of course not work if there is something else in your style.css that overwrites this. Can post as answer if this is what you needed. It's also possible to modify CSS inside the org file if that is what you need. – Hubisan Oct 23 '19 at 9:22
  • Thank you that worked! – smilingbuddha Oct 23 '19 at 21:46
  • Yes please do leave as an answer. – smilingbuddha Oct 23 '19 at 21:46
  • Please consider accepting @Hubisan's answer if it does solve your problem. – JeanPierre Nov 23 '19 at 8:49

In your style.css add .title {text-align: center;} to center the document title in the exported html file.

Classes used when exporting are documented in the org manual: CSS-Support. Or inspect the generated html file to see what element and class are used. For the document title this will be the following:

<h1 class="title">Hello World</h1>

It's also possible to modify the CSS style definitions inside the org file directly as follows:

  1. Add a #+HTML_HEAD_EXTRA to the top section in your org file. This will be appended to the HTML document’s head:

    #+HTML_HEAD_EXTRA: <style type="text/css">.title {text-align: center;}</style>
  2. Use inline html to include raw html:

    @@html:<style type="text/css">.title {width: 270px;}</style>@@
  3. Use a html export code block to include raw html:

    #+begin_export html
      <style type="text/css">.title {width: 270px;}</style>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.