PROBLEM :

The problem is the good way to center an image using css ?

Is the property text-align: center;

CSS Code
img {
 text-align: center;
}
[ad type=”banner”]

SOLUTION 1 :

That will not work as the text-align property applies to block containers, not inline elements, and img is an inline element.

Use this instead:

CSS Code
img. Center {
    display: block;
    margin: 0 auto;
}

SOLUTION 2 :
This solution doesn’t always work. if it doesn’t, try.

we tried the following solution.

CSS Code
img {
    display: block;
    margin: 0 auto;
}

SOLUTION 3 :
Another way of doing would be centering an enclosing paragraph.
text-align center is a good way to center an image, and did not specify that the property had to be a part of the img tag.

HTML Code
<p style="text-align:center"><img src="..."/></p>
[ad type=”banner”]

SOLUTION 4 :
You can do the following solution: text-align:

HTML Code
<center><img src="..." /></center>

SOLUTION 5 :
Here the solution is simply change parent align.
Try this one on parent properties text-align:center

Categorized in: