Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

can we append inline styles in RTE instead of classes

Avatar

Level 3

Hi,

 

Can we append inline styles directly instead of custom classes in RTE

 

Example : when custom style is selected in RTE it is appending as

<span class="text-blue"><span> instead of that can we append inline styles 

 

like <span style="font-size: 23px;
color: #FFF;"></span>

 

Please provide suggestions!

 

Thank you!

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Satish2info ,

 

Yes, you can do that using the RTE source edit plugin. But if it is removing your style attributes after submitting dialog then you need to enable those attributes from xssprotection.xml file. Check out this blog for more details.

 

 

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @Satish2info ,

If you have enabled source code plugin, IMHO It's absolutely OK to have inline styles with RTE. I have used many times in my past specially in Email Campaign.

However, It is best practice to add styles through dialog 

Screen Shot 2022-06-17 at 3.54.37 PM.png

Reference: https://experienceleague.adobe.com/docs/experience-manager-64/administering/operations/configure-ric...

Hope that helps!

Regards,

Santosh

Avatar

Level 3

Hi @SantoshSai 

Thank you for your reply,

 

Yes, we can able to achieve with RTE but my question is when we using the RTE when we select the particular style it will append corresponding style class instead of that i have to append direct style in RTE. Can we able to do this?

 

like :

 

RTE works like : <span class="text-blue"><span> instead of that can we append inline styles 

 

but i have to append directly  inline styles <span style="font-size: 23px; color: #FFF;"></span>

 

Regards,

Satish.

Avatar

Level 3

Hi @SantoshSai ,

As you mentioned you have used many times in the Email Campaign ,

 

We have used RTE in Email Campaign, when we use this it is appending classes directly instead of inline styles we are facing the issues with Gmail client bcz Gmail only supports inline styles so we are trying to achieve this through RTE. Could you please explain more about how you have achieved this in the email Campaign or you have used any alternative without using RTE.

 

Thank you,

 

Regards,

Satish.

Avatar

Community Advisor

@Satish2info You can implement JavaScript to fetch style and append it.

Avatar

Community Advisor

Hi,

For the email templates, you can use internal css styling and still live with class name instead of inline styling.

 



Arun Patidar

Avatar

Correct answer by
Community Advisor

Hi @Satish2info ,

 

Yes, you can do that using the RTE source edit plugin. But if it is removing your style attributes after submitting dialog then you need to enable those attributes from xssprotection.xml file. Check out this blog for more details.