# Centering an image in CSS

**URL:** <https://forum.kirupa.com/t/centering-an-image-in-css/154748>\
**Category:** web dev\
**Created:** [July 12, 2005, 1:41pm UTC](https://forum.kirupa.com/t/centering-an-image-in-css/154748 "2005-07-12T13:41:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davehead](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@Davehead](https://forum.kirupa.com/u/Davehead)\
**Post date:** [July 12, 2005, 1:41pm UTC](https://forum.kirupa.com/t/centering-an-image-in-css/154748/1 "2005-07-12T13:41:54Z")

</div>

Hi guys,  
I am in a bit of a pickle here. I have been trying to center an image in a div, but cannot seem to do it.  
I have searched and found [**this**](http://www.kirupa.com/forum/showthread.php?t=85500&highlight=center+image) thread, but it hasnt helped.

Basically I have:

**#picture\_nest  
{  
padding: 0px;  
display: block;  
float: left;  
width: 143px;  
margin-left: 0px;  
}  
.picture {  
text-align: center;  
}**

and I have it as so:

**\<div id=“picture\_nest”\>\<span class=“picture”\>** \<img src=“blah.jpg”\> **\</span\>\</div\>**

But obvioulsy “text-align: center;” is not working.

Any ideas ?

Cheers,  
D
