Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

center two floating divs in a container div?

What is the best way to center two floating divs in a container div?
0
wrynn
Asked:
wrynn
3 Solutions
 
SSupremeCommented:
I think the best way is to use CSS rules in separate .css file and link it to source file.
0
 
CCSOFlagCommented:
For container div:
text-align: center;

For divs you want centered:
display: inline-block;
*zoom:1;
*display:inline;

the zoom and second display is needed for IE.  Not sure about IE9 but IE does nto recognize inline-block as a display value.  You have to use those two in conjunction with each other and you'll get the effect of inline-block.  Proper web browsers will ignor the CSS that starts with *, so it also works in FF, Chrom etc...
0
 
David S.Commented:
The "best way" would depend on the situation. Here is one way: http://www.pmob.co.uk/pob/centred-float.htm
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now