Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tony Groome 261 posts 804 karma points
    Feb 02, 2015 @ 14:47
    Tony Groome
    0

    How do I align my columns?

    Hi All

    Spring has sprung and another problem beckons! 

    I am trying to align my columns, so from the screenshot taking the Cafe Pages, I want my Read More button to be the full width under the image of the sandwich and for the 2 columns to line up. So the third image down (a shot of Mars!) should be lined up with the News Text.

    Here's the code:

    <div class="column w220 gut30">

    <div class="box">

    <div class="column w110">

    @foreach(var page in CurrentPage.Children.Where("Visible && DocumentTypeAlias == @0 ||DocumentTypeAlias == @1", "Cafe", "Chapter"))

    {

    HtmlString summary = new HtmlString("");

    dynamic image = null;

    foreach(var apage in page.Children.Reverse().Take(1))

    summary = apage.summary;

    if (apage.HasValue("image"))

    {   

    var dynamicMediaItem = Umbraco.Media(apage.image);

    <div class="box">

    <img src="@dynamicMediaItem.umbracoFile" alt="@dynamicMediaItem.Name" width="100" float:left/>

    </div>

    }

    }

    }

            </div>

    <div class="column w110">

    @foreach(var page in CurrentPage.Children.Where("Visible && DocumentTypeAlias == @0 ||DocumentTypeAlias == @1 ", "Cafe", "Chapter"))

    {

    //HtmlString readMore = new HtmlString("");

    HtmlString summary = new HtmlString("");

    dynamic image = null;

    foreach(var apage in page.Children.Reverse().Take(1))

    summary = apage.summary;

    //readMore = apage.Url;

    <div class="box">

    <div class="section">

    <span style="line-height: 1.4em; font-size: 16px; font-weight: bold;">@page.Name</span>

    <p>@summary</p>

    <p><a class="buttonGrey block w160" target="_blank" [email protected] rel="nofollow">Read more...<span class="arrow"></span></a></p>

    </div>

    </div>

    }

    }

            </div>

    <!-- Read More Button here -->

    </div>

    </div>

    Thanks :)

    Tony

     

     

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Feb 02, 2015 @ 17:50
    Steve Morgan
    1

    Hi Tony,

    Your question looks to be a HTML and CSS layout issue. 

    I think you need to reogranise your code so that you have a container div for each section, output the image(s) in a column div inside this container floated left and the text in a different column floated right with an additional div below (in CSS with width: 100%) with the button.

    Then for each of your other sections start a new container div. 

    Does that make sense? If you're not sure what you're doing I would suggest you get it looking right in simple html first without any Razor (e.g. dummy content) and then try to recreate that html with razor and your "live" Umbraco content.

    For specific CSS questions you'll get much faster responses from Stack Overflow though I'd recommend you try googling your query first as almost every question has already been answered!  

    If you're really lost with what I've written then I suggest you work through a CSS and HTML tutorial on floating columns. 

    Hope that helps

    Steve

  • Tony Groome 261 posts 804 karma points
    Feb 03, 2015 @ 13:00
    Tony Groome
    0

    Hi Steve

    I'm thinking along those lines, grant you I almost have it working now....its the damn CSS. :(

    Tony

Please Sign in or register to post replies

Write your reply to:

Draft