T
T
to_east2019-01-26 14:40:51
css
to_east, 2019-01-26 14:40:51

Connecting and using svg icons in css?

Hello!
Question on the subject, more specifically how to declare style classes referring to the svg file:

@font-face {
    font-family: "Font Custom";
    font-style: normal;
    font-weight: 900;
    src: url("/static/fonts/font-custom.svg") format("svg");
}

.foobar {
    font-family: "Font Custom";
}

How to connect this or that figure from the svg file to the foobar class?
There is a glyph tag in the svg file with the glyph-name="align-center" attribute, for example, is it possible to refer to this name?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
to_east, 2019-01-26
@to_east

Everything came to me, the problem was that I did not mention that the whole thing was going on webpack, before that I used raw-loader for svg, in short, this rule solved my problem:

module: {
        rules: [
            {
                test: /\.(eot|svg|woff|woff2|ttf)$/,
                use: [{
                    loader: 'file-loader',
                    options: {
                        name: '[name].[ext]',
                        outputPath: 'fonts/',
                        publicPath: 'static/fonts/'
                    }
                }]
            },
        ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question