Hi all,

I'm trying to align a table centrally within a div and/or fieldset. I've tried various things but I've not had any luck so far.

I've been trying

#mydiv table {
    marging-left:auto;
    margin-right:auto;
}

but it hasn't shown any effect, thought this is the suggested method according to the websites I've browsed.

Thanks in advance for any help offered.

Recommended Answers

You need to assign a width as well.

 {width:##px:margin:0 auto;}

As an example.

Jump to Post

All 4 Replies

You need to assign a width as well.

 {width:##px:margin:0 auto;}

As an example.

On line 2, it won't work because you spelled "margin" wrong.

I only spelt it wrong here. It was just an example :). But I've done stuff like that before :D.

Thanks JorgeM. It's looking alot better now.

Be a part of the DaniWeb community

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