skytreader
skytreader

Reputation: 11707

Strip default CSS from Django CMS

I noticed that the text rendered by Django CMS' text plug-in is hard-coded with its own CSS, the p tags in particular. Is there a way to remove this styling? I want the text to inherit the style specified in the theme I am using. There does not seem to be an option to do this in the GUI and there is no mention in the docs for the text plug-in.

Upvotes: 1

Views: 812

Answers (2)

Timmy O'Mahony
Timmy O'Mahony

Reputation: 53999

If you look at the template used by the text plugin you'll notice that it simply renders the contents of TinyMCE (or whatever WYSIWYG editor you are using) so the markup you are seeing is likely from there, not the template.

You can override this template yourself by creating a text.html file in your templates folder (i.e /templates/cms/plugins/text.html) and adding a surrounding div :

<div class="cms-text-plugin">{{ body|safe }}</div>

now you can target the elements with CSS:

.cms-text-plugin p{ ... }
.cms-text-plugin h1{ ... } 

Upvotes: 2

Brandon Taylor
Brandon Taylor

Reputation: 34583

You can override the template for each CMS plugin by creating the same directory structure and file name in your templates directory. Then you can control the markup. This concept is the same as overriding any other template provided by a 3rd party in Django. It's just like overriding a template provided by admin, etc.

Upvotes: 0

Related Questions