Add CSS to specific topics

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Add CSS to specific topics

Unread post by John Johann »

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?
Simon_Dismore
Posts: 205
Joined: Thu Jul 13, 2017 2:57 pm

Re: Add CSS to specific topics

Unread post by Simon_Dismore »

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?
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.

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.
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Re: Add CSS to specific topics

Unread post by John Johann »

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.
Post Reply