#+TITLE: Hello World
#+AUTHOR: A. U. Thor
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>
#+HTML_DOCTYPE: html5
currently gives me this as output where the title is centered to the left.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this community#+TITLE: Hello World
#+AUTHOR: A. U. Thor
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>
#+HTML_DOCTYPE: html5
currently gives me this as output where the title is centered to the left.
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:
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>
Use inline html to include raw html:
@@html:<style type="text/css">.title {width: 270px;}</style>@@
Use a html export code block to include raw html:
#+begin_export html
<style type="text/css">.title {width: 270px;}</style>
#+end_export
.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