-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Shouldn't modals be vertically centered instead of appearing at the top? #14617
Comments
Gah, phones. |
I believe the user is more likely to have the mouse closer to the center of the window than closer to the top when they click on something that opens a modal. Also I think it looks nicer in the center, but that is just my opinion. Anyway, even if this cannot be said for all cases (that the users mouse would usually be closer to the modal most of the times if it was on the center), it can certainly be said in some cases. I'm mostly looking for a reason why it could make more sense to have the modal on top instead of the middle. |
Yeah, probably better to have them centered. I don't know if it's a simple CSS fix for this though. Plus, this might change some expected displays and behaviors for folks in v3.x, so for now I'm punting this to v4. Adding it to the list. |
Modals are now vertically aligned. Uses calc() to fix overflowing on mobiles.
Is this still considered for bootstrap v4? |
@morloderex Yes, there's a TODO bullet point for this in #17021. |
And pure css (with flex box) |
i don't think it's better or worse to have it in the center. just different. I don't think it detracts from usability having it at the top. maybe this can be the default behavior, but if we're going to switch this, we should provide an option to put the modal back at the top. IMHO there's definitely an argument to having it at the top and not centered. |
@browner12 I agree. I don't know which option is the best to be default, maybe there is no better option and it just depends on the use case, but ideally it should be possible to change this easily. |
So this is not a "how to" question because this answer: http://stackoverflow.com/a/20444744/3094399 on stackoverflow allowed me to solve my issue and implement this behaviour.
The questions then are:
Thanks
Edit: the stackoverflow solution I pointed to as an issue if the modal is bigger than the window. This can be fixed with a conditional statement but there is another answer that only uses HTML and CSS that works well and I think is better http://stackoverflow.com/a/24829651/3094399
The text was updated successfully, but these errors were encountered: