2

The ul and ol elements are often used in theming outside of the 'text'-context (e.g. category blocks, etc.). Therefore the bullets are removed by default.

Is there a way to add a class to all ul and ol elements outputted by CKeditor? For example class 'editor', so that we can theme the ul/ol elements differently if they are outputted by CKeditor (with bullets or decimals).

1

There is no reason to do that for styling purposes. You can target the ul and ol elements by their parent container. The classes depends on your theme output, but consider this for the Garland theme:

/* Style all ul and ol elements from the body output. */
#center .node .content ul,
#center .node .content ol {
  /* Styles here */
}

If you are missing classes you can add those in the page.tpl.php and node.tpl.php templates.

2
  • 1
    Not possible to style on .content, because this contains other ul's which need to be styled differently + I'm trying to get a very clean HTML output without any (drupal default) exceed div's and classes, so most of those are stripped by Mothership. However, the solution is easy. Install Display Suite and add a class (e.g. .editor) to the output of your body/text field :) Jul 2 '13 at 9:12
  • Drupal sucks in terms of clean HTML. Nov 28 '17 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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