Following this simple solution, I've used margin-left
and margin-right
to get the exported HTML page in a more reading friendly format with larger margins both sides:
#+HTML_HEAD_EXTRA: <style>*{margin-left: 2em}*{margin-right: 2em}</style>
So the page looks like:
This is a very long sentence as an
example of reading friendly large
margins in the exported HTML document
of my org file.
Instead of:
This is a very long sentence as an example of not-reading friendly small margins
in the exported HTML document of my org file.
The paragraphs do look better. However, the problem now is that the increased margins affect the TOC and all the list items in the body. Somethings like:
- List item 1
- Subitem 1.1
- Subitem 1.2
- Subsubitem 1.2.1
- List Item 2
- Subitem 2.1
- Subitem 2.2
where I'd much rather see:
- List item 1
- Subitem 1.1
- Subitem 1.2
- Subsubitem 1.2.1
- List Item 2
- Subitem 2.1
- Subitem 2.2
Now, is it possible to set a custom margin for text paragraphs only, not affecting lists? What would be a neat way to do it?
You can use the below css
#+HTML_HEAD_EXTRA:<style> *{margin-left: 2em;margin-right: 2em} ul, ol, li, a {margin: 0;} </style>
OR
#+HTML_HEAD_EXTRA:<style> p{margin-left: 2em;margin-right: 2em} </style>