Centering without specifying div width:
body {
text-align: center;
}
body * {
text-align: initial;
}
body div {
display: inline-block;
}
This is something like tag does, except:
- all direct inline childs elements (eg.
) of will also positioned to center
- inline-block element can have different size (comapred to
display:block setting) according to browser defaults