How can i center the form called form_login horizontally and vertically in my page ?
Here is the HTML I\'m using right now:
If you want to do a horizontal centering, just put the form inside a DIV tag and apply align="center" attribute to it. So even if the form width is changed, your centering will remain the same.
UPDATE
@G-Cyr is right. align="center"
attribute is now obsolete. You can use text-align
attribute for this as following.
This will center all the content inside the parent DIV. An optional way is to use margin: auto
CSS attribute with predefined widths and heights. Please follow the following thread for more information.
How to horizontally center a in another ?
Vertical centering is little difficult than that. To do that, you can do the following stuff.
html
Css
#parent {
display: table;
width: 100%;
}
#form_login {
display: table-cell;
text-align: center;
vertical-align: middle;
}