I am trying to center an inline div
in its parent. The parent element also has a child div
that floats to the right. Because of the right aligned
position:absolute
is the only way
DEMO http://jsfiddle.net/kevinPHPkevin/u4FWr/1/
.center {
display:inline-block;
position: absolute;
left:0;
right:0;
}
EDITED
not sure if this has already been suggested
Or you can absolute: position;
the right div
instead
DEMO http://jsfiddle.net/kevinPHPkevin/u4FWr/3/
.right {
display:inline-block;
position: absolute;
right:0;
}
set the right div css
position:absolute;
right:0;
relative to the parent div
#parent {
position:relative;
}