I have
.centered-holder {
margin-left: auto;
margin-right: auto;
clear: left;
display: inline-block;
}
Then
<div class="centered-holder">misc content 1</div>
<div class="centered-holder">misc content 2</div>
<div class="centered-holder">misc content 3</div>
I only want one max per line, is this actually possible somehow? It’s an iPhone HTML5 app so older browser restrictions aren’t an issue.
Depend of your CSS declarations and your markup, but you can try to put this CSS declaration on the parent container:
With this approach you avoid to transform the
.centered-holderto a block element, and you can still use for example thetext-align:centeron the parent container.You can find more informations here about white-space:
To finish, you can use these CSS declarations :
I found this question very interesting, so I give also the CSS declarations for IE6-7 (
pre-lineandinline-blockfixes). It should be usefull for some other people which have a similar problem.