By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

Centering two div tags

P: 20

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:

Expand|Select|Wrap|Line Numbers
  1. div.element {
  2.   float: right;
  3. }
Then the two elements would go on the same line, but would not be centered.
I'm kinda looking for something equivalent to this:

Expand|Select|Wrap|Line Numbers
  1. div.element {
  2.   float: center;
  3. }
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 :)
Dec 30 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
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.

Dec 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.