Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    41
    Rep Power
    15
    im sure what jharnois posted will work -- even if it's not what you're looking for (at least, from what i get out of your post)

    but, why would you want to use margins to center something? when the text-align would work better.
  2. #17
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    B/c using margins is the correct method for centering a block element such as a <div> while text-align should be used for inline elements. You have to do it in IE b/c it doesn't conform to the standards correctly -- it's simply a workaround.
  4. #18
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Location
    Queensland, Australia
    Posts
    827
    Rep Power
    141
    Unfortunately I can't use text-align : centre as content-area encloses a lot of other HTML for the page. I've just stripped it down here to show what isn't working.

    Yes, IE does not support the margin: auto; property correctly.
    But IE 6 does. I've read that it does everywhere and have seen it work for myself. But my page is the only page where I have seen it not work. Which leads me to belive that I must be doing something incorrectly.

    Is it possible headers could make a difference since we seem to agree that the code I've shown should work?
    Ooh, they have the Internet on computers now!
  6. #19
  7. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    Since you've stripped it down to relevant code it's hard for us to know wether or not anything else is affecting it. It is still possible to use the workaround by adding yet another <div> to the collection. Cross-browser compatibility is such a pain isn't it.
    Code:
    <div>
      <div style="width:100%;text-align:center">
        <div style="width:50%;margin-left:auto;margin-right:auto">Center Me</div>
      </div>
      This text should not be centered.
    </div>
  8. #20
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Location
    Queensland, Australia
    Posts
    827
    Rep Power
    141
    Thanks for the suggestion jharnois.

    This is the only piece of code I left out from my earlier post...

    Code:
    <!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>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    I would be interested to hear if this code works for anyone using IE6.
  10. #21
  11. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Location
    Queensland, Australia
    Posts
    827
    Rep Power
    141
    FOUND IT!!!

    I don't know why I didn't copy this bit of code into my previous post but DW automatically puts this line at the top of a XHTML compliant page...
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    I removed the line and "margin : auto" now works as it should. Booyah! I'm not sure what the intended function of this line is but without it the named CSS fonts sizes (ie. small, x-large) are all one size smaller.
    Ooh, they have the Internet on computers now!
  12. #22
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    41
    Rep Power
    15
    for a code editor - i recommend editplus - colors your code and you dont have to worry about extra lines you didnt put in the file
  14. #23
  15. Senior Polecat
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Jersey (the original version)
    Posts
    210
    Rep Power
    12
    aah ... that explains it. I've also had trouble with the XML declaration before (it drove me nuts with typeface sizing!) and it would seem that there are a number of IE specific bugs related to the inclusion of XML decs.

    And before any body gets on their high horse about "bloomin editors inserting their own code ... blah ... blah" it is worth bearing in mind that - according to W3C recomendations, all web pages using an encoding other than UTF-8 or UTF-16 should include the XML Declaration:

    http://www.w3.org/TR/xhtml1/#strict

    You can omit the line of course and specify your encoding using the meta tag:

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

    which dreamweaver also includes automatically. It seems that the guys at Macromedia are trying to cover the asses in terms of how best to specify encoding... but I hasten to add that it isn't their fault that IE doesn't correctly render page elements and styles when the XML is included - Microsoft did that all on their own!

    Icy
    Quidquid latine dictum sit, altum viditur.

    http://www.XSet.co.uk
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo