align my image in the div

Hello guys,

I am trying many things and now I am lost, then I need a help from you.

I have a purchase image and I want to align it in the center of my div, how can I do this?

this is my page that I am developing

site

thanks
Alex
LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
You need to display your image as a block-level element:

<img style="margin-left: auto;margin-right: auto;display:block" alt="" src="images/purchase.jpg">

Open in new window

The auto margins only work on blocks, and by default, an image is inline.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
hummm, you cleared my mind with your explanation. Thanks a lot Chris.

let me ask you that.

Imagine that I have some text and I'd like to have my image on the left and the text on its right in my div, What should I do ?
Chris StanyonWebDevCommented:
In that case, you'd need to float your image:

<img style='float:left;' src='...'>

In your page, this probably wouldn't work as it is, because the text content is in a different DIV.

Here's a good intro into floats: https://css-tricks.com/all-about-floats/
hidrauAuthor Commented:
once again, thanks a lot
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.