There is a logo. Contained inside an h1 tag belonging to the class logo .
In CSS, #logo text-align: left , I overload it in #logo img , I write text-align: center . Even in the img tag I prescribe align="middle" . If only henna, still left. Chrome debuggers and operas show that the image has the text-align: center property.

Just in case, the calculated style looks like this:

 background-attachment: scroll; background-clip: border-box; background-color: #EEE; background-image: url(header_outer.jpg); background-origin: padding-box; color: #333; display: block; font-family: arial, helvetica, sans-serif; font-size: 16px; height: 1133px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; text-align: center; width: 1263px; 

    3 answers 3

    text-align does not work for images, this property aligns text only. To align something, this object needs to set the display:block; property display:block; , then set it width: 1263px; and at the end assign it the margin:0 auto; property margin:0 auto; .

    • you will have to remove: <code> margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; </ code> otherwise what I wrote above will not work - Perl

    I decided by placing the img tag in <div align="center"> , well, or just <center> , but this is some kind of crutch.

      Alignment is not advisable to do in the stylesheet css))) It is better to do this in the html code of the page you want. To do this in the tag <div align="center"></div> or similarly in the tag <table> .

      Or, for example, in your case like this:

      <H1><img src="../images/картинка.jpg" width="200" height="200" align="middle"/> Текст по центру изображения</H1>

      Or <div align="center"><H1><img src="../images/картинка.jpg" width="200" height="200" align="middle"/> Текст по центру изображения</H1></div>

      Or another option:

      The html code itself.

       <div class="imgCenter"> <img src="картинка.jpg" border="0" width="200" height="200" alt="" /> </div> 

      In the css property.

       .imgCenter { text-align:center;} 

      PS remove extra spaces)))

      • Just not, here is the alignment through align already deprecated , preferably vice versa, through CSS. - Oleg Arkhipov