...

View Full Version : Centering Issues



Gabby7
08-22-2009, 02: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.

Scriptet
08-22-2009, 03: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" />
</div>

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" />
</div>


Then inside a css stylesheet you'd add:

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum