[cXF] Node icons with image

[cXF] Node icons with image

With padding-left I have tried more than enough settings, while noticing these have no effect at all.
Padding-top I can try.
The image is webp.
 
Through playing with width: xxpx; I made images smaller.
The problem is now how to get the images away from the border, because padding-left does not work!
 
You can use this for specific node:
Less:
.node.node--id31.node--depth2.node--forum {
    padding-left: 12px;
}


If you're going to add custom icons for all nodes, you can try with this one for all:
Less:
.node.node--depth2.node--forum {
    padding-left: 12px;
}
 
@BassMan - i adjusted te settings for office forum, but to no avail!

CSS:
.node.node--id140 {
        .node-icon i { display: none; }

    &.node--forum {
        .node-body {
        .node.node--id31.node--depth2.node--forum {
         padding-left: 12px;
}
        }
        .node-icon {
            background-image: url('/styles/enhance/node icon/office.webp');
            background-repeat: no-repeat;
            background-position: center;
            background-size: contain;
            width: 34px;
        }
        &.node--read .node-icon {
            opacity: 0.4;
        }
    }
}
 
I've used this code (I've changed the node to yours, so try with this one):

Less:
.node.node--id31 {
        .node-icon i { display: none; }

    &.node--forum {
        .node-body {
            padding-left: 12px;
        }
        .node-icon {
            background-image: url('/styles/enhance/node icon/techniews.webp');
            background-repeat: no-repeat;
            background-position: center;
            background-size: contain;
            width: 34px;
        }
        &.node--read .node-icon {
            opacity: 0.4;
        }
    }
}


And this is what I get:

Screenshot 2021-08-07 at 22.26.45.webp


It's the same code as in the tutorial.
 
If for some reason it's not working on your site, use this code:

Less:
.node.node--id31 {
        .node-icon i { display: none; }

    &.node--forum {
        padding-left: 12px;
        .node-icon {
            background-image: url('https://piepcomp.nl/styles/enhance/node icon/techniews.webp');
            background-repeat: no-repeat;
            background-position: center;
            background-size: contain;
            width: 34px;
        }
        &.node--read .node-icon {
            opacity: 0.4;
        }
    }
}
 
Instead of single images, can this be done with sprite-sheet?
Haven't tried, but it should go. Add something like this to the code:

Less:
width: 22px;
height: 22px;
background: url('sprite_sheet.png') no-repeat 0px -22px;
background-size: 100%;
}

Change the sprite sheet path and other values accordingly.
 
Maybe you can try with the code for mobile:

Less:
@media (max-width: @xf-responsiveMedium) {
    ***
}

Just wrap the code you have with the code above and adjust the values.
 
Top Bottom