1.

Solve : center Tag help?

Answer»

I have a LOGO JPG file I would like to have Centered on the Page. So I use this code




It still goes on the left why?http://www.webdesigntuts.net/css-tutorials/how-to-center-a-website-with-css.html

The same applies to centering any HTML element.In other words

CSS:
Code: [Select]div#image {
  text-align: center;
}
div#image img {
  margin: 0 auto;
}

HTML
Code: [Select]<div id="image">
  <img src="logo1.jpg" height="100" alt="" border="0" align="">
</div>
Code: [Select]<div class="box">
<p>Hello world </p>
</div>

Code: [Select]d.box
{margin-left:auto;
margin-right:auto;}
If you want just the picture centured, you'll have to use text-align:center; as indicated above ...

How's this for a newbie thought. . .  Use the align code within your image tag like this. . .



And if it still defies control or NEEDS extra tweaking, maybe try putting it in its own paragraph or TD which is aligned how you like it. Thanks Quote from: leslieed on February 09, 2012, 09:32:06 AM

How's this for a newbie thought. . .  Use the align code within your image tag like this. . .

<img src="logo1.jpg" height="100" alt="Logo for PRETTY WEB SITE" border="0" align="CENTER">

The ALIGN attribute is deprecated and should never be used, for reasons it's not worth going into here, but which are well documented elsewhere.


Discussion

No Comment Found