Visual editor adding <p> tag automatically

Topics: Feature requests, General, Troubleshooting, Visual editor
Mar 15, 2011 at 9:27 PM
Whenever the user edits a page and tries to set the content with the visual editor it will wrap that content inside paragraph tags. I think I understand correctly that everything needs to be inside a tag but is there somewhere I can go to change this default from the <p> tag to the <span> tag since the <span> tag does not result in unwanted styling being applied? Text within a <span> tag will not introduce line breaks or any other unnecessary styling but <p> tags will. Thanks for any help on the subject, telling the user that's how it was built and if it is a problem then just go into the source and remove them is not cutting it anymore.
Mar 15, 2011 at 10:10 PM

I faced similar problem, but in my case I needed to replace <p> tags with <span>-s in order to the result into a <a></a> tag. I solved it by adding a small xslt function that was converting <p> tags to <span>-s, it's pretty late in Denmark, I'll find and post the code I used tomorrow.

Mar 15, 2011 at 11:20 PM

Info on how you can modify the HTML from the Visual Editor: and

Mar 15, 2011 at 11:22 PM

Thanks for the reply but I think I have fixed my problem by explicitly setting a style that I was not aware existed by default.

Anyone else looking to fix this can put the following in their style sheet.

p {
margin: 0px;
Mar 16, 2011 at 9:09 AM

Any way, there's a change that somebody will need the code:


In layout:

<f:function name="Container.RemovePTags">
	<f:param name="Content">
		<rendering:placeholder id="contentplaceholder" title="Content" default="false" />



And there's an xslt function Container.RemovePTags, which should have a string parameter "Content", and has the following template:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" exclude-result-prefixes="xsl in mp csharp"
	<xsl:param name="content" select="/in:inputs/in:param[@name='Content']" />
	<xsl:template match="/">
				<!-- markup placed here will be shown in the head section of the rendered page -->
				<xsl:apply-templates select="mp:ParseWellformedDocumentMarkup($content)" mode="CopyWithoutPTags" />

	<xsl:template match="@* | node()" mode="CopyWithoutPTags">
			<xsl:apply-templates select="@* | node()" mode="CopyWithoutPTags" />

	<xsl:template match="xhtml:p" mode="CopyWithoutPTags">
		<xsl:apply-templates select="node()" mode="CopyWithoutPTags" />

	<xsl:template match="p" mode="CopyWithoutPTags">
		<xsl:apply-templates select="node()" mode="CopyWithoutPTags" />


Dec 15, 2016 at 12:46 PM
Hello everyone. I have similar bug on the editor. I'm using orchestra CMS and i'm installing new updates. So my question is: do i can to add this solution to prevent empty divs appearance? Is this solution is suitable for problem when divs with &nbsp of 160 appears? And will it be normally updated if a change config file of visual editor? Thank you for your fast reply.