View Full Version : Centering Issues

08-22-2009, 03:59 PM
Hello+ I am doing a 'proof of concept' page using Dreamweaver 8. I am trying to get everything to center on the page no matter what the screen resolution is. Is this possible? I am having no luck using the following code:

<div align="center"><img src="images/msbanner.png" width="813" height="116" /></div>

<div align="center"><img src="beginningwebstuff/snarling tiger.jpg" width="468" height="478" /></div>

I have tried using the <center><img src="..." /></center> and no luck.
I have tried using the <div style="text-align: center;"><img src="..." /></div>
I have tried using the <align=center><img src="..." /></align>

I test using EI8, Firefox, & Netscape browsers. Does using Layers have anything to do with things not centering in the browser? Thank you in advance for any guidance on this.

08-22-2009, 04:25 PM
adding align="center" is depreceated as is <center> as there effects can be re-created in CSS.

To center any DIV with a set width you simply use margin: 0 auto;
<div style="width: 812px; margin: 0 auto;">
<img src="images/msbanner.png" width="813" height="116" />

Note I add the CSS inline, it's best to give your DIV a class or ID and refer to it from an external stylesheet like:

<div class="myclassname">
<img src="images/msbanner.png" width="813" height="116" />

Then inside a css stylesheet you'd add:

.myclassname { width:813px; margin:0 auto; }

08-27-2009, 10:14 PM
Thank you for the information - I see what I was missing before! Thank you!