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

Re: Automatic centering and positioning

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 8 Nov 2013 14:16:58 -0800
Message-ID: <CAAWBYDCaYL69ahfQ9XPL2Hy19e=NDHx8AdZpJUyjwAPwrBqjvA@mail.gmail.com>
To: Dirk Schulze <dschulze@adobe.com>
Cc: Paul LeBeau <paul.lebeau@gmail.com>, www-svg <www-svg@w3.org>
On Fri, Nov 8, 2013 at 2:14 PM, Dirk Schulze <dschulze@adobe.com> wrote:
> 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's not what I said.  Being able to opt into an alternate CSS
display mode is all that is necessary.  In other words, SVG elements
start out as display:svg or whatever, but you can switch that to one
of the other layout managers.

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

...yet.  Wait for fantasai and I to finally take the time to take over
Positioning next year.  I've had Plans for a couple years concerning
it.

~TJ
Received on Friday, 8 November 2013 22:17:45 UTC

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