W3C home > Mailing lists > Public > www-svg@w3.org > November 2013

Re: Automatic centering and positioning

From: Dirk Schulze <dschulze@adobe.com>
Date: Fri, 8 Nov 2013 14:14:26 -0800
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Paul LeBeau <paul.lebeau@gmail.com>, www-svg <www-svg@w3.org>
Message-ID: <DA72D645-6F93-4AF9-9F89-30E435521396@adobe.com>

On Nov 8, 2013, at 6:51 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Thu, Nov 7, 2013 at 2:27 PM, Paul LeBeau <paul.lebeau@gmail.com> wrote:
>> Hi all
>> 
>> I have spent a bit of time on Stack Overflow lately, answering questions on
>> SVG.  It seems a very common use case that people want to centre elements
>> inside other elements.  For example, text in a circle, image in a box.
>> 
>> I have been wondering if this use case has been discussed before and whether
>> there were any previous proposals or interest in adding some sort of feature
>> that can automatically position elements with respect to a box or other
>> element.
>> 
>> Obviously you can achieve some control with child <svg>s and the text
>> baseline properties, but these can be hard to use and can require manual
>> tweaking.  Something automatic would be nice.
>> 
>> I had an idea or two about how you could do this, but wanted to check
>> whether other people agree it would be desirable (or not).
> 
> The right way is to continue integrating SVG with CSS more completely,
> allow elements to be nested (already proposed by Doug), and then allow
> things to switch into other layout modes.  CSS has centering and
> positioning primitives; reinventing in SVG would be a bad time.

You know that I do not agree to have SVG using the CSS box layout model by default. As mentioned in the initial post, SVG is a graphical format and has a different philosophy than a document based format as HTML (described as absolute positioned). We should not throw the graphical perspective over board so easily. Working more on the proposal of Cameron to unify SVG and HTML more and be able to add SVG elements in an HTML context directly seems to be a better way IMO.

That said, I do not thing that CSS addresses the need here. The original poster but also other posters suggest a position relative to one object (left of it, right of it and so on). I do not think that CSS addresses these kind of use cases properly either.

Greetings,
Dirk

> 
> ~TJ
> 
Received on Friday, 8 November 2013 22:14:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:47 UTC