Skip navigation
digitalroots
Currently Being Moderated

Dreamweaver 8 - Issues centering web page

Jul 15, 2012 5:36 PM

Tags: #dreamweaver #8 #layers #page #center

I recently started my own business and am on a budget so decided to design the web page myselt with Photoshop and Dreamweaver 8.  It went well except for the fact that my page won't center itself on screens, and b/c I created it on a display that is 1920x1080 I don't have good results on smaller screens.  I used layers, and can't convert to tables b/c of the overlapping layers I have.  I treid recreating the whole page again and not using overlapping layers, but once I converted to tables and viewed in browser I found that my buttons were moved all around.  I'm really having a difficult time with this and have spend the last two days trying various fixes with no luck...Any help would be apprecitated - the site is up and here is the link www.digitalrootsstudio.com

 

Thanks in advance

 
Replies
  • Currently Being Moderated
    Jul 16, 2012 5:03 AM   in reply to digitalroots

    Using absolutely positioned layers to build your site is possibly the worst decision you could make.

     

    What you have done  is given your layers a positive left position which positions them way over to the right of  the screen.

     

    Its NOT a good idea to use absolutely positioned layers if you want to center your design BUT if you do then start with a 'container' <div> which is positioned relatively (see css code below) and as wide as your layout. This will then contain ALL of your absolutely positioned layers. The absolutely positioned layers take their left/top co-ordinates from the top/left of the 'container' <div>

     

    #container {

    position: relative;

    width: 800px;

    margin: 0 auto;

    }

     

    Using the above method will centre a design which is reliant on absolutely positioned layers.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2012 8:13 AM   in reply to digitalroots

    digitalroots wrote:

     

    So I would put the above text right after the body tag on top of html?  Do I need to put the above code again at the end of the html, or only on top?

     

     

    Yes.

     

    <div id="container">

     

     

    Then all your absolutely positioned layers go here

     

     

    </div><! close the container-->

     

     

    below is a simple example of absolute layers inside a relatively positioned container <div>. Note how the absolutely positioned layers move when you re-size the browser viewport window.

     

    I stress using absolutely positioned layers is NOT a good solution to be using but it may be the only solution if you know little about website construction.

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title>Untitled Document</title>

    <style type="text/css">

    #container {

        position: relative;

        width: 800px;

        margin: 0 auto; /*this centers the page */

    }

    #one {

        position: absolute;

        top: 100px;

        left: 0px;

        width: 150px;

        height: 150px;

        background-color:#CF3;

    }

    #two {

        position: absolute;

        top: 100px;

        left: 150px;

        width: 150px;

        height: 150px;

        background-color:#39F;

    }

    </style>

    </head>

     

    <body>

    <div id="container">

     

    <div id="one">Absolute layer one</div>

    <div id="two">Absolute layer two</div>

     

    </div><!-- close container -->

    </body>

    </html>

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2012 11:11 AM   in reply to digitalroots

    Layers seemed the easiest way to lay it out,

    A common newbie mistake.  APDivs/Layers seldom work well for primary layouts.  Here's why.

         http://apptools.com/examples/pagelayout101.php

     

    This 3-part tutorial discusses the process of taking your Design comp in Pshop or Fireworks to CSS Layout in DW. 

        

         Part 1 - Initial Design

         http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt1.html

     

         Part 2 - Markup preparation

         http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt2.html

     

         Part 3 - Layout and CSS

         http://www.adobe.com/devnet/dreamweaver/articles/dw_fw_css_pt3.html

     

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points