Question:

Is it okey to design web pages using absolute positioned divs?

by  |  earlier

0 LIKES UnLike

I'm not what you would describe as a beginner with web page design but I have never designed anything other than for personal use.

Up until now, I have always designed the page layout using divs positioned using position:absolute which gets them exactly where I want them on the page with no fuss.

It is only now that I have realised that I have never seen a "proper" website use this technique in page design, instead they use a container div and put divs in that and position them using the float and margin attributes.

What I want to know is, should I stop using position:absolute and use the more "standard" way of doing things? I can see advantages in this (eg. getting the footer always at the bottom without js)

If so can you point me to the direction of designing pages using a container div (not aimed at beginners)?

Thanks for your help,

Colin

 Tags:

   Report

4 ANSWERS


  1. Its total wrong to say not to use div and positioning its bad practice, when in fact we are getting rid of using full table designs which weren't even intend to be used for that purpose.

    Anyways all you need to learn is how to use divs or layers with css really good that you know where the usual bugs will appear and that's all.

    You should be using relative and absolute layers because absolutes don't move. When creating a center design layout that adjusts to monitor sizes use relative layers.

    I prefer using just regular divs and css.  


  2. I usually create a container div about 760px in width and center it using css code. (yes, you need a stylesheet)

    so the html would be something like:

    <div class="container">Your content here</div>

    css:

    body {

            margin:auto;

            text-align:center;

    }

    .container {

            width:760px;

    }


  3. DIVs/CSS are good.  Absolute positioning is okay if you keep in mind that what you are positioning will be placed in the same spot no matter what a user's window size is.  This is ok if you set it positioned for what you expect to be a minimum sized browser window,

    Normally, it's best to stay away from absolute positioning so as to make your pages more fluid.

    Ron

  4. Putting everything in divs and setting them to absolute positioning is bad practice. The main concern is that it will cause the page to extend off the side of the window for people who have smaller monitor resolutions. When you allow for your page elements to position and size themselves dynamically, the page stands a better chance of looking good at all screen resolutions. It kind of depends what kind of page you're making, though.

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.