Has anyone gone through the process of using a data view to display items horizontally?

Item1             Item2             Item3
Metadata1     Metadata2     Metadata3

Item4             Item5             Item6
Metadata4     Metadata5     Metadata6

I'm looking to do this and set a condition to check for x items and create a new row.

  • I figured out how to get them to display horizontally, but don't know how to go about setting the conditional to create a new row. My XSL isn't the best
    – Jordan
    Sep 30, 2014 at 16:52

1 Answer 1


Yes it can be done, I'm currently doing it on something I'm working on. The key is to have a fixed width container for your items. Then for each item, it sits in a div with a fixed width and displayed inline-block. This will get you the automatic wrapping you want.

<div style="width: 900px;">
<div style="width: 280px; padding: 10px; display: inline-block;"><!--Repeat for each item --></div>
  • Oh ok, that makes sense. The route I was going was to smash all of the item info into each <td> and set an XSL variable to keep a count and start a new row based off that. I like your way more, lets it be more dynamic..and less XSL.
    – Jordan
    Sep 30, 2014 at 16:57
  • Ya, since it's a DVWP, you have full control of the output, so spitting out your own markup works best here than trying to adapt to the default markup. Sep 30, 2014 at 16:58
  • 1
    I did a very basic data view with this approach and seems to work very well. Now just to format it correctly. Thanks!
    – Jordan
    Sep 30, 2014 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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