Guide Creating custom User banner styling

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,944

Likes

130,105

Resources

3,396

Bits Credits

492

LEVEL

11

5,910 XP

By default, XF comes with the following user banner styles:

1566747742470-png.png

Creating custom styling using the Other, using custom CSS class name option is fairly straightforward.

This guide will explain how to.

The easiest way by far to add new prefix styling and to ensure it inherits all of the core styling is to edit the app_user_banners.less template.

Look for the section in the template highlighted in the screenshot below:
1566746468224-png.png

Then just add your custom entries after the orange entry and before the closing }, as follows:
1566746538270-png.png

I recommend using a name which won't cause any potential conflicts with the core code, or third party add-ons.
I prefix all of my custom entries with the acronym for my site -- cta -- and also like to give it a descriptive name, so in this case I have used ctaSupporter.

The two values/colours in the curly brackets denote the text colour, in this case white, and the background colour, in this case #008800.

XF will then generate the border colour based on those values, using the core CSS.

Finally, configure the user group:
1566746708977-png.png

The result of all that is this:
1566746760594-png.png

You can of course style it as you wish, adding icons, images, etc.

To do that you would use the extra.less template.
The following example adds a Font Awesome (https://fontawesome.com/icons?d=gallery ) star icon in front of the text.
1566746995913-png.png

Like so:
1566747030985-png.png

If you found this tutorial useful, donations of positive emojis are gladly received. :cool:
 

Moxx

User Suspended

Status

offline

Posts

4

Likes

1

Bits Credits

0

LEVEL

0

0 XP

Member suspended from NullForums
not working
 
Liked by:

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,944

Likes

130,105

Resources

3,396

Bits Credits

492

LEVEL

11

5,910 XP

not working
What do you mean? Custom CSS won't work if you don't construct it correctly.

What exactly "isn't working" for you.
 
Liked by:

Moxx

User Suspended

Status

offline

Posts

4

Likes

1

Bits Credits

0

LEVEL

0

0 XP

Member suspended from NullForums
For me this guide dont helped but i do it my way and now its works

1695338867532.png1695338900310.png
 

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,944

Likes

130,105

Resources

3,396

Bits Credits

492

LEVEL

11

5,910 XP

For me this guide dont helped but i do it my way and now its works

View attachment 25761View attachment 25762

I would create a new template for your user banner styles and import them to extra.less to prevent excessive single styling pages as you continue to build. Lighthouse scores can diminish if you load too much styling in a single file as the time can take longer to load based on so many different situations.

Nonetheless, good styling choices. Running your css locally looks decent.

You'd import it somewhere on your extra.less, best done at the top.

Import .less
Code:
<xf:include template="my_template.less" />

Import general
Code:
<xf:include template="my_template" />
 

Latest threads

Forum statistics

Threads
57,886
Messages
88,878
Members
54,767
Latest member
Zencibaba31
Top Bottom