Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2009
    Location
    USA
    Posts
    24
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Centering Issues

    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:

    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.

  • #2
    Regular Coder
    Join Date
    Apr 2008
    Posts
    685
    Thanks
    15
    Thanked 105 Times in 104 Posts
    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; }

  • Users who have thanked Scriptet for this post:

    Gabby7 (08-27-2009)

  • #3
    New Coder
    Join Date
    Jul 2009
    Location
    USA
    Posts
    24
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Thank you

    Thank you for the information - I see what I was missing before! Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •