Text areas in HTML export (The Org Manual)

Next: CSS support, Previous: Math formatting in HTML export, Up: HTML Export [Contents][Index]

#### 13.9.11 Text areas in HTML export

Before Org mode’s Babel, one popular approach to publishing code in HTML was by using ‘`:textarea`’. The advantage of this approach was that copying and pasting was built into browsers with simple JavaScript commands. Even editing before pasting was made simple.

The HTML export back-end can create such text areas. It requires an ‘`#+ATTR_HTML`’ line as shown in the example below with the ‘`:textarea`’ option. This must be followed by either an example or a source code block. Other Org block types do not honor the ‘`:textarea`’ option.

By default, the HTML export back-end creates a text area 80 characters wide and height just enough to fit the content. Override these defaults with ‘`:width`’ and ‘`:height`’ options on the ‘`#+ATTR_HTML`’ line.

    #+ATTR_HTML: :textarea t :width 40
    #+BEGIN_EXAMPLE
      (defun org-xor (a b)
         "Exclusive or."
         (if a (not b) b))
    #+END_EXAMPLE