Centering two div tags

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hgeithus
    New Member
    • Oct 2008
    • 20

    #1

    Centering two div tags

    Hi.

    I have two images with a caption underneath it. (like this example shows: CSS: figures & captions)

    So, I want two or more images (with caption) to follow each other on the same line. The question really boils down to this:

    How do I center two div tags that are on the same line?

    I could do this in my CSS-file:

    Code:
    div.element {
      float: right;
    }
    Then the two elements would go on the same line, but would not be centered.
    I'm kinda looking for something equivalent to this:

    Code:
    div.element {
      float: center;
    }
    I've heared someone speak of the "display: inline;", but I tried to use it, but it didn't work out very well..

    Any help is really much appreciated :)
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    if only the image and the caption needs to be centered use "text-align: center;" If the div should be centered too, use the same on the containing element. If you need something like "float: center" (i.e. text wrapping around a centered image) that's a bit more complicated.... . there google will help.

    regards

    Comment

    Working...