Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(image): Support the image to be centered when using a different H… #1618

Merged
merged 1 commit into from
Jul 30, 2020

Conversation

ko2in
Copy link
Member

@ko2in ko2in commented Jul 29, 2020

Description

This PR supports the image component to be centered horizontally which doesn't use HTML img tag. For example, using anchor tag as image link or a DIV container wasn't able to be centered in the page despite using centered image class name.

The group images were supposed to be center when using centered class name, but it never really were. It only set auto for left and right margin but with no width declaration which doesn't make the images to stay center. So, auto margin for left and right of the group images doesn't make sense and was removed in this PR. Instead, it's rendering as flex box and the images inside are now centered as it supposed to be.

The group images can also share the same vertical alignment or can have independent alignment for it's own now.

Testcase

Before: https://jsfiddle.net/v759o1rb/1/

After: https://jsfiddle.net/5tpk3evz/1/

Closes

#1608

…TML element

The current image component can only be centered with img element. It is not able
to center when using a different HTML element, for example, an image link with
anchor tag or a DIV container.

This PR would support to center the image not only for img tag, but also for other
HTML element by using `centered` flag.

This PR would also support to display the group images horizontally center. Additionally
the group images can now share the same vertical alignment as `top`, `middle` or `bottom`
together or can have it's own vertical alignment.

Closes: fomantic#1608
@lubber-de lubber-de added lang/css Anything involving CSS state/awaiting-reviews Pull requests which are waiting for reviews type/bug Any issue which is a bug or PR which fixes a bug labels Jul 29, 2020
@lubber-de lubber-de added this to the 2.8.7 milestone Jul 29, 2020
Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very awesome and effective fix. 👍 It even works fine in IE11 😳 😄

Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lubber-de lubber-de merged commit 51ca1ed into fomantic:develop Jul 30, 2020
@lubber-de lubber-de removed the state/awaiting-reviews Pull requests which are waiting for reviews label Jul 30, 2020
@ko2in ko2in deleted the fix-image-alignment branch August 3, 2020 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/css Anything involving CSS type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants