I'm currently working on a chat system.
I want to keep a div message box in the center of the screen then a disconnect button and send message button
on each side of it.

[disconnect] [message box] [send]

but when I tried

<div align="center" style="float: left;">

the message box and button wasn't centered anymore
what's another way I can achieve this?

thanks.

If you want to horizontally center a div, the easiest way is to apply a fixed with and a margin of auto.

For example...

<div style="width:640px;margin;0px auto;">
    -- Your Div Content --
</div>

Ok I got it to work thanks

glad you solved your issue. -take care.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.