Jump to content

Center Div Within Div And Stll Float Them


pioneerx01

Recommended Posts

I am trying to get a simple menu to have few item next to each other in the row, but still be centered with the page.

 

<div ID="parent">

<div ID="child">Menu Item 1</div><div ID="child">Menu Item 2</div><div ID="child">Menu Item 3</div>

</div>

 

How would I CSS that? I am having issues centering them on the page and keeping them next to each other at the same time.

Thanks

Edited by pioneerx01
Link to comment
Share on other sites

To parent you're setting this properties:

 

#parent {

margin: 0 auto; /* Auto working only in W3C browsers, no IE, sorry  */

}

 

To fix it in IE, you should to wrap parent div with <table align="center">

Edited by Volter9
Link to comment
Share on other sites

  • 2 weeks later...

I am trying to get a simple menu to have few item next to each other in the row, but still be centered with the page.

 

<div ID="parent">

<div ID="child">Menu Item 1</div><div ID="child">Menu Item 2</div><div ID="child">Menu Item 3</div>

</div>

 

How would I CSS that? I am having issues centering them on the page and keeping them next to each other at the same time.

Thanks

 

As above. Set the parent div to be

 

margin: 0px auto;

 

And it most definitely does work in IE!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.