Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've noticed that SharePoint 2010 wraps rich text fields (multiline text) with DIV tags, which can be annoying. I've got a custom XSL template for the columns being pulled by a content query web part and would like to format the text correctly; unfortunately, the extra "naked" DIV tags (no attributes) cause line breaks where I don't need them.

For example, the following has a line break:

Address: <xsl:value-of select="@MyAddressColumn" disable-output-escaping="yes"/>

So it comes out like this:

Address: 
123 Main St.

I want it to be this instead:

Address: 123 Main St.

Is there any way to prevent these DIV tags from being generated around the content by SharePoint? Thanks.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

One way to fix this was to append a class on a tag surrounding the address, and then add display:inline to the nested DIV:

.test div
{
    Display:inline;
}


<DIV class="test">address: <DIV>123 main st.</DIV></DIV>
share|improve this answer
    
Thanks, Anders. This doesn't get to the bottom of the issue, though. And it will add the style to all descendent DIVs, which might not be exactly what we want. I've tried using jQuery/CSS to fix it, but would like to know where the DIV is generated and if it's possible to modify that code. –  Alex C Aug 14 '11 at 10:17
2  
The DIV tag is generated in the RenderControl for either InputFormTextBox or one of its parent controls. If you want to remove those DIV's you could create a control adapter for it, but it seems like a lot of hazle for something that can be solved by one line of CSS :-) blog.mastykarz.nl/inconvenient-control-adapters –  Anders Rask Aug 14 '11 at 10:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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