center two floating divs in a container div?

Posted on 2011-10-05
Last Modified: 2012-05-12
What is the best way to center two floating divs in a container div?
Question by:wrynn
    LVL 22

    Accepted Solution

    LVL 16

    Expert Comment

    I think the best way is to use CSS rules in separate .css file and link it to source file.
    LVL 10

    Assisted Solution

    For container div:
    text-align: center;

    For divs you want centered:
    display: inline-block;

    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...
    LVL 42

    Assisted Solution

    by:David S.
    The "best way" would depend on the situation. Here is one way:

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
    In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
    In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now