From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: Scaling HTML-exported SVG Date: Sun, 24 Jul 2016 23:26:49 +0200 Message-ID: References: <87y44tx1h5.fsf@iki.fi> <87y44qdipu.fsf@iki.fi> <878twqq3df.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRQvH-0001HD-T7 for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 17:26:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRQvE-0001Ku-LV for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 17:26:55 -0400 Received: from mail2.b1.hitrost.net ([91.185.211.205]:49539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRQvE-0001Kp-EA for emacs-orgmode@gnu.org; Sun, 24 Jul 2016 17:26:52 -0400 In-reply-to: <878twqq3df.fsf@iki.fi> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Jarmo Hurri Cc: emacs-orgmode@gnu.org Jarmo Hurri writes: > The method you suggested above - setting id - works (all tests done in > Chrome). Mine are in Firefox. > But setting id-values is cumbersome, because you need to do it > for every file. > It is also possible to set a CSS class similarly, that is, modifying > your example above, > > #+html_head_extra: > > #+attr_html: :class svgfig > [[path/to/image.svg]] > > This also works and is better, because then it is possible to set a > common class for all SVG figures, and handle them with a single CSS > rule. Sure, if they should mostly be scaled to the same size. I just didn't make that assumption. > Better, but not yet perfect, because I still need to add a > attr_html to every SVG figure. > But there seems to be a way around this. With the last approach the > generated HTML looks something like > > Indeed. Now I'm confused, because this example seems to mean I got several things wrong earlier today. First, it seems one *can* scale an SVG image by setting attributes on the element, not just by scaling the container element as I thought. At least in FF and Chrome. And second, Org passes attributes from #+attr_html to the element, not to the container
as I wrote, though I could have sworn that was what I saw when I tested today. On that note, I think I'll go to bed... But first: > Why don't we just set a common class for all SVG-images in an HTML > export by default? Then we could still use an to embed it, and > control its size from CSS. > It seems to me that this solves the problem, and requires an extremely > small change. Me too. At least, I cannot think of any obvious disadvantages, and it could be helpful if you want all or most of your SVGs to be scaled to the same size (or otherwise styled the same way). Particularly if you need to distinguish them from tags embedding other media, like videos. (If you're *not* using for anything beside SVGs, or at least not in
environments, you could just style objects, couldn't you? e.g.: object { width: 200px; } or slightly safer .figure object { width: 200px; } But I agree that an explicit 'svg' class could be better.) Yours, Christian