www.webdeveloper.com
Results 1 to 6 of 6

Thread: which is best?

  1. #1
    Join Date
    Sep 2004
    Posts
    219

    which is best?

    Hi guys,

    best way to postion a div (and most practical) what do you choose?

    top: 10px;
    left: 10px;
    (css2, displays correct in FF and 6.5)

    margin: 10 0 0 10;
    (css1, need hack for IE)

    i know i have asked this before, but didnt get a clear answer at the end as to which is the best to use (i know they display the same)

    going to be postioning divs alot in this project and want to do it right!

    thanks guys

  2. #2
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Margins are often better.

    6.5? What's 6.5?

    You need to use units unless the number is 0.

    Why would you need a hack for IE?
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  3. #3
    Join Date
    May 2004
    Location
    dobson ave.
    Posts
    694
    Hi -
    It really just depends on where you want it...
    as I don't think there are many 'semantics'
    issues w/ css except to compact the code as
    much as you can!

    Padding works well, as does position:relative;
    [which tweaks an element from its orig. posit.
    in the flow] but margins are best, as K. stated.

    Keep in mind the nagging browser differences
    and then lay them out to best suit the project - -

    Good luck,
    El

    P.S. -
    In case anyone didn't know -
    top:value; and left:value; wouldn't work w/out a position:relative; or position:absolute; as part of the properties for that element - and units are
    needed with the values ;-)
    Last edited by LJK; 12-12-2005 at 06:00 PM.
    F-fox 2.0 :: US :: el design site :: 768 kbps :: WIN

  4. #4
    Join Date
    Sep 2004
    Posts
    219
    hi guys thanks for your answers

    @Kravvitz
    6.5 was ment to be IE6.5 forgot to write ie sorry! why would i need a hack? because ie and ff interpert the margins different dont they? i have used it and came out different.

    @LJK
    good points there!

  5. #5
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Perhaps you encountered "collapsing margins".

    http://www.w3.org/TR/REC-CSS2/box.ht...apsing-margins
    http://www.complexspiral.com/publica...psing-margins/

    IE6.5? Do you mean IE7 beta 1?
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  6. #6
    Join Date
    Dec 2002
    Location
    Seattle, WA
    Posts
    1,843
    mozilla, opera, and internet explorer render magins similarly

    although i have found that for the body element in opera it uses padding instead of margin

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles