I need all images in org-mode displayed with 40%. Means I need the file itself displaying the pictures small, not the html export. This works flawless by putting above every image:

#+attr_html: :width 40%

Now to avoid repeating the upper line above each image I tried setting the attribute per subtree to no avail:

:EXPORT_OPTIONS: attr_html: :width 40%

How can I set this globally per org file or per subtree?

  • I don't think this can be done in Org mode, but I'm pretty sure it can be done with CSS. Whenever you want to do something to every HTML element of a given type, CSS is the way to go.
    – NickD
    Feb 26, 2022 at 16:00
  • 1
    I did not get a notification when you changed your question. In the future, you might want to add a comment that you did so.
    – NickD
    Feb 26, 2022 at 19:23
  • 1
    @NickD Had already started writing a comment, yet stopped middle way. Thought there's no need to "outsmart" the algorithm. Gut feelings still prevail. Will gladly do as you suggested next time.
    – jjk
    Feb 26, 2022 at 21:55
  • Yup - we live and learn...
    – NickD
    Feb 26, 2022 at 22:17

1 Answer 1


Following up on my comment, you can use CSS to do that per file (it is not possible however to limit the CSS to a subtree).

All you have to do is add this at the top of your file:

#+HTML_HEAD_EXTRA: <style> img { width: 40%; } </style>

EDIT: In answer to the modified question, set the variable org-image-actual-width to the width (an integer denoting the number of pixels) you want. To use a fraction of the text width, set it to a list whose car is that fraction:

 (setq org-image-actual-width '(0.4))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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