Fixed sidebar avatar

Rob

Well-known member
In sidebar_visitor_panel template the following code exists:-

Code:
<xen:avatar user="$visitor" size="m" img="true" />

It should be possible to change the size to "s" but it seems the size is expressly set in
sidebar.css along with style property visitorPanelAvatar.

The avatar HTML image tag contains width and height attributes so there is no need to specify these in CSS and the CSS actually over-rides the html attributes.

It just seems strange to me that you cant change the size to "s" and not have it take effect. It seems weird also that sizes need to be specified in both css and html attributes on the image tag.
 
I believe it is by design. The "m" argument is used to select which size to create a new re-sized avatar from, at least that is how I use the <xen:avatar... On my forum index I have 2 instances of a user's avatar displayed, both sizes rendered in different sizes than the pre-set sizes for small and medium, and this was done with just adding a new class (one for each new size I wanted) to EXTRA.css. The new small size was based off of the "s" sized avatar, and my new larger one off of the "m" sized one.
 
I know what the m and the s argument are for.... however, they are sized specifically in HTML attributes on the image tag itself and also in CSS. I think this is incorrect and needless extra markup.

I expected to change the 'm' to an 's' and get a small avatar but there was in fact no change due to css overrides.

Hope that gives a little more clarity.
 
Here is the CSS I use (placed in EXTRA.css) to have the users browser re size the 192 X 192 image to 135 X 135:

.avatar img {
height: 135px;
width: 135px;
}

for the small I use this:

.avatar_42 .avatar img {
height: 42px;
width: 42px;
}

I find the above works fine for me, and as the img tags do contain height and width attributes based on the size of the image, it should still be w3 compliant.
 
I know what you are saying lawrence but I disagree with the out of box functionality.

Xenforo out of the box should not be over-riding its own default functions.

By default this renderers a medium avatar <xen:avatar user="$visitor" size="m" img="true" />
The above renders an image with width and height set in the image tag itself.
It should not be the case out of the box that xenforo is overriding the above markup in CSS.

Let users override the markup in extra.css, thats what it is for but xenforo overriding itself natively (and with the exact same dimensions) just seems silly.
 
Top Bottom