Bulma: Login form - vertical and horizontal center

Created on 7 Feb 2018  路  3Comments  路  Source: jgthms/bulma


This is about Bulma.



Overview of the problem

This is about the Bulma CSS framework




Description


Hello. I am really liking the styles. I only have some minor questions at this point, and it deals with the difficulty in taking something like a login form and centering it both horizontally and vertically. The samples that i found require wrapping in hero tags, columns, etc. Ultimately, it was too verbose for what I want in relation to accessibility.

I need 2 things to move forward.

  1. on desktop, i don't want the input widths 100%. Mobile that is great but desktop it's not, how can i do that?

  2. How to center a form vertically and horizontally without a lot of extra html elements and tricks, and to keep it accessible-friendly.

Thank you kindly.

Most helpful comment

I solved it by removing everything on my container except the form, and created a css class like this, which i placed on my top level div. Works great. Leaving this here in case it helps anyone else out.

.centerall {
height: 100vh;
padding: 0;
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
}

All 3 comments

I solved it by removing everything on my container except the form, and created a css class like this, which i placed on my top level div. Works great. Leaving this here in case it helps anyone else out.

.centerall {
height: 100vh;
padding: 0;
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
}

You just needed to add is-desktop and is-vcentered to columns.
display is not flex by default on columns. is-desktop makes it so.

Was this page helpful?
0 / 5 - 0 ratings