Open bohnacker opened 11 years ago
Definitely something we should have! In CSS, centering an object around its reference point would be something like margin: -50%
. We could introduce a shorthand like centered:true
that compiles to this margin. That way, centering would also work with elements positioned relative to the right and/or bottom edges which wouldn't work when using x and y.
the centered
property works fine for top level objects. But as soon as there are children appended, the result is not as expected. In this example (examples_real_world/Example_01.html) the circles should be in a horizontal line.
Is there a way to fix it?
Hm, you are right. I think the main Problem is that we are positioning everything absolute. That way, adding child elements does not change the size of the container. I currently can't think of a way to to work around this. Maybe we can do something with transforms here, but there are a few other issues with those which we need to solve first.
Most times it would be nice to give the position of shape as a coordinate for the center of the shape. Would it be possible to introduce x and y as new "css-properties"?