When moving content from an existing CMS into Tridion, I have run across <style> blocks in the RTF fields which the Tridion RTF strips out. Is there a way to prevent this?

  • 1
    Do you really mean a style element, so something like <style>p {text-decoration:underline;}</style> in your RTF, so it ends up in the body of your HTML? Commented Apr 13, 2015 at 8:42
  • Yes, that is exactly what I mean. I tried adding style to the supported tags in the TcmXhtml.config, but that didn't work so far.
    – Travis
    Commented Apr 13, 2015 at 14:27
  • 1
    Style elements are not allowed in the body of an HTML document (only in the head), unless you consider an HTML5 style element, which then must be using the scoped attribute <style scoped>, but I don't think that will work here either. You should really consider using inline styling on your elements (or beter use classes and add them in a CSS, rather than a style block) Commented Apr 13, 2015 at 14:38
  • @BartKoopman normally I would agree with you, but unfortunately, I'm not the user that entered the content, and I don't have the access to add it to the external stylesheet file. Thank you for the suggestion of the scoped attribute but as you guessed, that didn't work. If I can't find a solution, I will probably request that the users move that style block to their external css file, but I wanted to see if there was a Tridion solution first.
    – Travis
    Commented Apr 13, 2015 at 15:09
  • 1
    Yeah I understand you are trying to migrate existing content in, and I guess this is just a case of: garbage in = garbage out ;o). I'll add another suggestion in an answer, but I'm afraid this can't be solved easily. Commented Apr 13, 2015 at 15:18

2 Answers 2


Since <style> elements are officially not allowed in an HTML body element, I think the TcmXhtml.Config isn't going to help you (as you confirmed by trying already).

So the best solution I can give you (it will mean extra work) is to see if you can split the RTF content up in two parts for the migration:

  1. Strip out the <style> tags (by means of XSLT for example) and add the remainder in the RTF field.

  2. Copy the contents of the <style> tag(s) to a separate field in the Component (plain text field) and in your Template you can decide whether to place it back in an (illegal ;o) <style> tag in the body of your HTML, or if you move it up to the head or even in a CSS file (the latter is best but will probably be most work).


As nuno answered it here : https://stackoverflow.com/questions/9613598/how-to-add-custom-tags-to-rich-text-field-in-sdl-tridion

There is a file named TcmXhtml.Config under [Tridion]\web\WebUI\Core\Controls\FormatArea\TcmXhtml, where the rtf supported tags are defined. please check if your tag is there and if not present add it.

  • I'm thinking <style> must be a special case because it's a default hidden element, and so doesn't fit into the definition of block, inline, or empty. I tried adding it to all three but that didn't work.
    – Travis
    Commented Apr 13, 2015 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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