I wish to change the code block background color in org mode but below example doesn't work.
#+ATTR_HTML: :background-color #eff0f1;
#+BEGIN_EXAMPLE
hello world!
#+END_EXAMPLE
Can I insert inline css code with #+ATT_HTML
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 communityYes, you can do what you want with #+ATTR_HTML
. However, your HTML is incorrect. If you look at the output you will see <pre class="example" background-color="#eff0f1;">
but there is no background-color attribute in HTML. Instead, use this:
#+ATTR_HTML: :style background-color:#eff0f1;
#+BEGIN_EXAMPLE
hello world!
#+END_EXAMPLE
This will generate <pre class="example" style="background-color:#eff0f1;">
, which will apply color to that block only.
You can try this:
#+HTML_HEAD: <style type="text/css">.example {background-color: #eff0f1; color: #ff0000;}</style>