Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7714547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:09:24+00:00 2026-06-01T02:09:24+00:00

When creating HTML5 and CSS3 designs is it better to primarily use margin and

  • 0

When creating HTML5 and CSS3 designs is it better to primarily use margin and padding for your designs over positioning or the other way around?

I’ve never really thought about it before and use both side by side to get the results where needed but it’s possible to design in both ways as shown in the examples below:

HTML

<div>
<ul>
<li><span>1</span></li>
<li><span>2</span></li>
</ul>
</div>

CSS Example 1 – Using margin, padding

div{
    width:1000px;
    margin:auto;
    }
ul{
    margin-left:10px;
    width:100px;
    }
li{
    height:30px;
    }
span{
    margin-top:10px;
    }

CSS Example 2 – Using just positioning
(Apart from the margin:auto ..)

div, ul, span{
    position:absolute;
    }   

div{
    width:1000px;
    margin:auto;
    }
ul{
    left:10px;
    width:100px;
    }
li{
    height:30px;
    }
span{
     top:10px;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:09:26+00:00Added an answer on June 1, 2026 at 2:09 am

    For a typical page layout, Example 1 is much cleaner and you should choose that, given the choice.

    Example 2 is bad because as soon as you start setting position: absolute on everything, any flexibility your design may have had goes out the window. You have to set explicit dimensions on everything.

    In general (there are exceptions), avoid position: absolute for the main layout unless it’s only way to do it.

    Here’s an example of the kind of problem I was talking about. It would appear that the user ended up using JavaScript to fix his problems. Not good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I'm creating a HTML5 game that moves circles around a hexagonal grid what
I'm looking into creating an Web or iPad application that will use HTML5. After
I'm creating an drawing application with HTML5 canvas but is having problems with positioning.
I am trying my hand at creating an HTML5 form styled with CSS3. However,
I am creating a web application using HTML5 canvas to draw images ( like
we are creating an application using HTML5 for Iphone, IPAD and Android. Now the
i'm looking at creating a web game using html5 canvas and javascript. i was
I'm creating a whiteboard application using SVG in HTML5, and javascript to manipulate the
I am creating an app using the Bespin editor and HTML5's localStorage. It stores
any specific browser will support for html5 and jquery mobile application? While creating mobile

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.