how to stop removing br tags

lawrence whittemore asked on January 30, 2019 19:46

Kentico keeps removing break tags on me and replacing them with non breaking spaces... how do I stop this behavior?

in version 11

Recent Answers


Eric Dugre answered on January 30, 2019 20:41

Where and how are you entering the BR tags? I just tried this in an Editable Text web part in the Source view of CKEditor and the BR tags remained untouched when I saved the page.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on January 30, 2019 21:12

I'm doing it in the code, but it only seems to remove certain ones. If have a couple divs that is floating right and left and I have to br tags before them so the image in the div shows on a new line. but for what ever reason whenever leave the source code and strips the second br tag out.

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on January 30, 2019 23:00

You are using the CKEditor, right? (WYSIWYG Editor in the admin?)

If so, CKEditor removes empty elements. Say you have <span><i class="icon" /></span> CKEditor will remove that whole thing. YOu need to have something like <span><i class="icon">&nbsp;</i></span>

A non breaking space will stop it from being removed. It usually doesn't remove it the first time you save, its the second time. I think it also will remove duplicates, that might be why your BR's are being removed, but I usually type my code in notepad and paste in the editor and save once, and it's usually good.

I think you can disable that in the config file, but I forget which setting.

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on January 20, 2020 21:47

building a new site and getting the same issue. It seems to happen when I have 2 breaks before a div. I can remove it and save the page in source view but the second it reloads it adds the nbsp tags back and removes a the second br tag.... really weird.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.