Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Image Alignment - Center #322
taking a quick look at your source of the
if that's all that's necessary (it looks like everythings hooked up in a nice reusable way), adding a
Am I correct or is there more work required than that? I may play around with it when I get some free time
And added a component
Whether or not to use
Thanks for your contribution!
margin-left: auto; margin-right: auto
Here is another way to center the image horizontally, let's check how it will look like:
'display': 'block', 'margin-left': '50%', 'transform': 'translateX(-50%)', '-ms-transform': 'translateX(-50%)'
(The -ms prefix is needed for IE9)
At least in my tests I got better results. For example, open the default example page and try to center the image there. On the first screenshot below it is shown how does it look like with
Both screenshots are without
@ipeychev yes I like that transform solution better for true centering. I do think both approaches could be desirable in different situations, one for centering relative to the container (transform) and one for centering relative to surrounding content (auto margin), although I imagine true centering with transform would be the more popular choice if you had to pick only one. I'm not sure what type of icon would be used to differentiate the two. I'll give