I had posted the question once to http://doctype.com/within-same-line-have-center-element-right-most-element, but didn't get a good answer for that. I posted it here and hopefully will get a good feedback ;)
<div style="float:right">
right most, same line as hello world and will not push hello world!
</div>
<div style="text-align:center">hello world</div>
Currently, the right most element, will push the "hello world" out from center of the page. How can I avoid this?
I wish
- Hello world is still at center
- The right element is still same line as Hello world
- The right element is at right most
- Both are top most
Thanks.
I tried some suggestion by others but it won't work.
<div style="text-align:center; width:100%;">
Hello World
<div style="float:right">right most, same line as hello world and will not push hello world!</div>
<div style="clear:both"></div>
</div>
For the above code, I tested with IE 8. They will not be at same line. And I tested with firefox 3.6.8, The "Hello World" will be pushed toward left by the right side element.