|
Posted by Els on 08/18/05 11:23
Ed Jay wrote:
> Mark Parnell <webmaster@clarkecomputers.com.au> wrote:
>
>>Previously in alt.html, Ed Jay <edMbj@aes-intl.com> said:
>>
>>> I'm having a heck of a time figuring out how to center text or boxes.
>>
>>http://dorward.me.uk/www/centre/
>
> Thanks, Mark. That was a great help.
>
> Allow me to impose and ask another question. I'm trying to center a box
> with text aligned both left and right. Example:
> Test1 Test2
>
> I defined a simple box as:
>
> .menu {
> border: 1px solid black;
> margin-left: auto;
> margin-right: auto;
> width: 300px;
> }
>
> The code on my page is:
>
> <div class=menu style="text-align: left;">Test1<div
> style="text-align:right;">Test2</div></div>
>
> The result is:
>
> Test1
> Test2
>
> Why?
Because ...
Well, add a visible border to each div, and you will know :-)
To make it work, you should float the first one left, and give it 50%
width (probably a bit less to make it work in other browsers too), and
give the second one a left margin of 50%.
--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Various Artists - Cinema -Sharon Lifshitz
[Back to original message]
|