Subscribe to Acqal
Got Thoughts? Write Us!
Approved TYPO3 Agency
Acqal is an approved TYPO3 agency focusing on support, training and website migration.
This means that we...
- are available on TYPO3.org
- make substantial contributions to TYPO3 teams
- are registered as business members of the TYPO3 Association
- have completed more than four TYPO3 projects
- have proven our technical abilities with quality TYPO3 extensions
- use TYPO3 for our own website
Popular Blog Posts
Tech Tuesday Went Snowboarding at T3BOARD09
TYPO3 and Other Open Source WCM Systems Dissed Again
Automatic tt_news META descriptions via Acqal's extension aqnewsmeta
TYPO3, comments and Gravatar via Acqal's extension comments_gravatar
TYPO3 Extension cbstarter Version 1.3.2 Released
Sunday at T3BOARD09 in Laax, Switzerland
Not Good, Not Bad, Just Different
Increase TYPO3 Workspace Relation Limits
Getting Help With TYPO3
Looking into TYPO3 Webhosting?
Blog Topics
Virgil on Twitter

Recent Blog Posts
US Political Campaign Websites - The Basics
My Talk at T3CON10 Dallas - TYPO3 User jobs and Tasks
Dallas Barbeque Joint Reviews
T3CON10 Dallas
Acqal is Going Through Some Changes
Creating a MySQL Database for TYPO3 using CPanel
Acqal Promotes Biking and Families with World Vision
It's Official T3CON10-Dallas Web Site Launched! Join Us!
Create a simple "Contact Us" mail form in TYPO3
Configure TYPO3 for Localized Websites
Blog Archives
Add Custom CSS Classes to the TYPO3 RTE
Easily enable custom CSS classes for TYPO3 RTE
The TYPO3 RTE is quite flexible. One easily proven aspect, is by the ability to select what CSS styling to apply by highlighting some text and choosing a custom CSS class from a drop-down. Furthermore, making this happen only takes a few minutes.
There's 2 basic steps to making custom CSS classes available in the RTE.
- Create custom classes in your CSS stylesheet, with only one per line.
- Modify the RTE via Page TSConfig
- Link the RTE to the site CSS stylesheet
- Assign the custom classes to text types
Sample content.css with custom classes.
.coding { font-family: monospace; font-size: 1.1em;}
.note {background: #dfd; padding: 1em; border-top: 1px #bdb dotted; border-bottom: 1px #bdb dotted;}
.important {background: #ffd; padding: 1em; border-top: 1px #ddb dotted; border-bottom: 1px #ddb dotted;}
.warning {background: #fdd; padding: 1em; border-top: 1px #dbb dotted; border-bottom: 1px #dbb dotted;}
.float_left { float: left; display:inline; margin-right: 1em; margin-bottom: 0.15em;}
.float_right { float: right; display:inline; margin-left: 1em; margin-bottom: 0.15em;}
.center { text-align:center; margin: 0.5em auto}
/* these are for showing alignment in RTE on the backend */
.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }
.align-justify { text-align: justify; }
RTE Page TSConfig sample
RTE {
default {
# link to site css stylesheet
contentCSS = fileadmin/templates/css/screen/content.css
# clear typical styling
classesAnchor >
classesLinks =
# set classes available to these properties. Paragraph is another name
# for block
classesCharacter := addToList(coding, note, important, warning)
classesParagraph := addToList(coding, note, important, warning, float_left, center, float_right)
classesTD := addToList(sub)
classesTable := addToList(full, fixed)
# list all available classes here, otherwise they're removed on RTE save
proc.allowedClasses := addToList(coding, note, important, warning, float_left, center, float_right, sub, full, fixed)
}
}
In the above Page TSConfig, we adjust the CSS stylesheet being referenced via contentCSS. A relative file path is from the website root with TYPO3 installed is sufficient.
Next, as we want to supplement, not replace the classes applicable, we use the addToList TypoScript function to add our custom CSS classes. These CSS classes are assigned to specific text types, like block text-strings, elements and tables as shown by the classesCharacter & classesParagraph samples.
Once you add your custom classes, you must make sure all of them are listed in the proc.allowedClasses property. Otherwise, your custom classes will not show up.
Reference
If you've got problems or questions, ask them in our comments section.
Keywords:
- typo3 htmlarea, rtehtmlarea, classesparagraph, allowedclasses, css


Add comment
* - required fieldThings it would like to know:
* customize output generated in frontend
* customize view of text in backend (should look like in frontend)
* add typical styles specific for site
* adding special elements to text, like source code with syntax highlighting
* ,,,
thanks.
PS. Please, use little bigger default font size in textarea for comment.
For frontend output handling, that's TypoScript.
For backend look of text, that's TSConfig, like above's contentCSS.
Add styling options to RTE is covered in this post.
Special elements could be handled through additional custom extensions or using content replacers. I'm not sure what exactly you're asking for.
showTagFreeClasses = 1
otherwise it wont work! (at least not with 4.1.13 > )
//Peter