Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Two columns of <div> top aligned

  • 05-06-2011 1:50pm
    #1
    Registered Users, Registered Users 2 Posts: 1,002 ✭✭✭


    I've been trying to do this for ages now and I can't figure out a way to do it.
    (I have a style in an xsl file that is formatting data in a CQWP in SharePoint.)

    This is the problem: div vs table. I want the row of divs to be top aligned the way the table <td>'s are. I can only put one div into my xsl file as it gets replicated for each piece of data returned in the CQWP. Any ideas?
    Table-vs-Div.jpg


Comments

  • Posts: 0 [Deleted User]


    tl;dr

    but maybe http://masonry.desandro.com/ ?


  • Banned (with Prison Access) Posts: 1,332 ✭✭✭desaparecidos


    tl;dr

    It's not that long.

    You're going to have to wrap each "row" of divs for them to "top aligned" like table cells.

    A table row:
    <tr>
    	<td>Fill with content</td>
    	<td>Fill with more content</td>
    </tr>
    

    Same effect with divs
    <style>
    div.cell{float:left}
    div.clear{clear:both}
    </style>
    <div class="wrap">
    	<div class="cell">content</div>
    	<div class="cell">content</div>
    	<div class="clear"></div>
    </div>
    

    Of course if the data you are presenting makes sense in a table, use a table.


  • Moderators, Science, Health & Environment Moderators Posts: 9,035 Mod ✭✭✭✭mewso


    We don't need to go charging to a div every time though do we :)

    A simple <br class="clear" /> between them and give the clear class a clear:both; setting in css to force a new line. Use a div wrapper if the divs within have some kind of semantic meaning as a group. Please tell me folks that you don't still wrap your ul menu with a <div id="nav"> or something equally pointless.


Advertisement