How do you scale an SVG inside a :before pseudo Element

Viewed 1462

I have a class that puts an SVG-icon inside a before element. I want to scale this SVG because at the moment it still appears to big. However nothing I tried worked.

.svg-icon:before {
    content: url('icons/svg-icon.svg');
    position: relative;
    /* none of these work*/
    height: 40px;
    width: 40px;
    background-size: 40px 40px;
}

So what can I do to adjust the SVG-size?

Edit: I seem to be able to adjust it, when I set position: inline-block. However, when I do that, I can't use top and bottom, which I need.

Solutions: @I haz kode and @NiZa had the right idea. This way it works:

.svg-icon:before {
    content: "";
    background: url('icons/svg-icon.svg') no-repeat;
    position: relative;
    display: block;
    height: 100px;
    width: 100px;
    top: 70px;
    left: 60px;
}
0 Answers
Related