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
https://forums.phpfreaks.com/topic/220987-small-question-about-floating/
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.