Jump to content

small question about floating


fortnox007

Recommended Posts

HI all,

 

just a small question; mostly when I have a layout with floats I am using margin with literal pixels to put the floated div back in the center. The question is is there a smarter way?

for instance: a wrapper div with 2 child div's.

 

#wrapper{
width: 500px;
margin: 0 auto; /*to center align it */
}
#left{ /*this is inside wrapper */
  width:200px;
  float:  left;
  margin:25px  /* 100/4=25 of wrapper */
}
#right{ /*this is inside wrapper */
  width:200px;
  float:  left;
  margin: 25px
}

 

I tried margin: 0 auto; on the child div's but that didn't have any effect.

If the above is the right way to go please let me know so I know I can stop worrying

Link to comment
Share on other sites

Well i am trying to find out if the  is the right way to center align a wrapper div of 500px, and within it it has 2 divs of each 200 px also center aligned (wh are floating).

 

But i allready noticed that IE 6 is being a pain in the ass. but the fix they brought (display:inline) doesn't seem to work

 

 

 

[attachment deleted by admin]

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.