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

This is a follow up to How to distribute People Search Core Results over two columns using XSL,

When I use the suggested code block in that article

    <xsl:for-each select="All_Results/Result">
         <xsl:if test="position() mod 2 = 1">
              <div style="width:50%;float:left;"><xsl:call-template name="SingleResult"/></div>
         </xsl:if>
         <xsl:if test="position() mod 2 = 0">
              <div style="width:50%;float:right;"><xsl:call-template name="SingleResult"/></div>            <div style="clear: both;"></div>
         </xsl:if>
    </xsl:for-each>

I end up with
1
    2
3
    4

Any suggestions on how to get the results
1 | 2
3 | 4

Thank you.

share|improve this question
add comment

2 Answers 2

The code you posted includes the following after the right column

<div style="clear: both;"></div>

Is this perhaps making your content wrap since you have the widths of your first two divs set to 50%.

share|improve this answer
add comment
<div style="width: 100%">    
 <xsl:for-each select="All_Results/Result">
   <div style="width:50%;float:left;"><xsl:call-template name="SingleResult"/></div>
 </xsl:for-each>
<div>

Assuming there is no other styling then this should work fine as it will fill the container div with two at 50% and then wrap to the next line. What you are seeing is what usually happens if you have some padding or margin which means that two divs at 50% are actually more than the 100% outer div.

share|improve this answer
add comment

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.