I'm trying to insert SVG images formatted using CSS in a project for CHM export.
I'd like to link the CSS only to those topics which also have the respective SVG.
Where do I need to put it?
Add CSS to specific topics
Moderators: Alexander Halser, Tim Green
-
- Posts: 206
- Joined: Thu Jul 13, 2017 2:57 pm
Re: Add CSS to specific topics
If you're talking about using an external stylesheet with SVG, the most natural place to reference it would in the SVG document itself. That way it will only be included where there's an SVG image.John Johann wrote:I'm trying to insert SVG images formatted using CSS in a project for CHM export. I'd like to link the CSS only to those topics which also have the respective SVG. Where do I need to put it?
But I wonder why you care about this? CHM's are loaded from the local file system, so there's no bandwidth issue, and stylesheets will be cached by the browser in most cases.
By the way, if you are looking to have style inline SVG symbols in HTML pages, Sara Soueidan's article Styling SVG <use> Content with CSS might be helpful.
-
- Posts: 305
- Joined: Mon Aug 21, 2017 7:35 pm
Re: Add CSS to specific topics
Thanks.
Experimented further. I think the problem was more with how I was inserting the svg image file itself.
I put the svg.css in the Baggage.
When I insert the svg via Insert > image, the styles are not applied in the output.
When I insert the image via a div in an html code object, I get a missing object error.
When I insert the image via a div in an html code object, and include an img src tag as a fallback, it seems to work.
Experimented further. I think the problem was more with how I was inserting the svg image file itself.
I put the svg.css in the Baggage.
When I insert the svg via Insert > image, the styles are not applied in the output.
When I insert the image via a div in an html code object, I get a missing object error.
When I insert the image via a div in an html code object, and include an img src tag as a fallback, it seems to work.