XF 2.0 3 widgets horizontally aligned

kankan

Well-known member
Hi there,

Any way to achieve this by default :
Align some widget horizontallly :

.webp

If not, how can i perform this ?

Thank you.
 
Hi @Justwise

remove one of this from the code:
Code:
    <div class="grid">
        <xf:widget key="forum_overview_share_page" />
    </div>

Then in code <div class="grid"> for other two widgets add extra classes like<div class="grid class1"> and <div class="grid class2">, for instance.
Ok. How about the css? They all have .grid

How will I edit the 2 different class in the css?
 
Well, I was so happy last night, but today after looking in details on my creation, I understand what a mess I created. )
@BassMan would you guide me please, when you have a minute?

So here is how I was thinking. xF has fixed 1200px width, I have 3 columns, so I need 400px width pictures. And for mobile screens 400px is kind of ok, so I started to dance from 400px width. And here is my first question. I use windows, but 55% of my visitors are oh IOS or Mac. And I heard some about that retina thing. So I better use 800px width that will resize by browser & css? Or...? Please advice.
 
So here is how I was thinking. xF has fixed 1200px width, I have 3 columns, so I need 400px width pictures.
Less if you take padding and space between into account
And for mobile screens 400px is kind of ok, so I started to dance from 400px width. And here is my first question. I use windows, but 55% of my visitors are oh IOS or Mac. And I heard some about that retina thing. So I better use 800px width that will resize by browser & css? Or...? Please advice.
Yes, larger pictures reduced do look better on Retina, so I use max-width:400px or whatever display width you want. It's not a deal breaker, they just look a bit sharper.
 
Last edited:
So I got so excited about ability to put things in 3 columns that I decided to put forum nodes on forum list in 3 columns too. And got stuck...

I go to node_list_category. Do I add grid-main class to the div on 2nd line or on 4th?

Code:
<xf:macro name="depth1" arg-node="!" arg-extras="!" arg-children="!" arg-childExtras="!" arg-depth="1">
    <div class="block block--category block--category{$node.node_id}">
        <span class="u-anchorTarget" id="{$node.Data.getCategoryAnchor()}"></span>
        <div class="block-container">
            <h2 class="block-header">
                <a href="{{ link('categories', $node) }}">{$node.title}</a>
                <xf:if is="{$node.description}"><span class="block-desc">{$node.description|raw}</span></xf:if>
            </h2>

And what div should I add class grid?
Help! )))
 
Hi @BassMan. This is amazing, Thank you!
Just one question in which I hope you can help.
What kind of <xf:if> would I need to add to the code to achieve the following:
Desktop - Box above nodes
Mobile - Box below nodes
 
Hi @BassMan. This is amazing, Thank you!
Just one question in which I hope you can help.
What kind of <xf:if> would I need to add to the code to achieve the following:
Desktop - Box above nodes
Mobile - Box below nodes
XenForo template syntax cannot achieve that out of the box. You can either duplicate the content and hide it with a css media query in the appropriate spot, or supply your backend with a device discovery method.
 
XenForo template syntax cannot achieve that out of the box. You can either duplicate the content and hide it with a css media query in the appropriate spot, or supply your backend with a device discovery method.
Ah that's a shame, but thanks for the headsup. Think i'll leave it as it is for the time being!
 
Evening,
So i've managed to get this to work, however i'm having some trouble working out how I add a different background image to each of the three boxes.

In my widget I have
Code:
<div class="grid-main">
    <div class="grid">
        <xf:widget key="xfrm_overview_top_authors" />
    </div>
    <div class="grid">
        <xf:widget key="xfrm_whats_new_overview_new_resources" />
    </div>
    <div class="grid">
        <xf:widget key="xfrm_stats" />
    </div>
</div>

and in my extra.less I have
HTML:
.grid-main {
    display: flex;
}
.grid {
    display: flex;
    flex-direction: column;
    flex: 1 1 250px;
    margin-left: 2%;
}
.grid:first-of-type {
    margin-left: 0;
}
.grid .block, .grid .block-container {
    height: 100%;
}
@media (max-width: @xf-responsiveMedium)
{
    .grid-main {
        display: inherit;
    }
    .grid {
        margin-left: inherit;
    }
}

Which piece of code in the extra.less corrosponds to box 1,2,3 so I can add the background in?
 
Top Bottom