Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Positioned differently in Mozilla versus IE, etc....mystery?

  1. #1
    Join Date
    Feb 2007
    Posts
    46
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Angry Positioned differently in Mozilla versus IE, etc....mystery?

    I am new to website development. I can't seem to figure out how to get stuff to display the same (positioning) across the different browsers.
    Here's an example:

    http://www.bossteel.com/News/HomeDepot.html

    The text section of the page (the part that begins "Steel Goes Retail...") seems to start further down on the page when viewed in Mozilla, Safari, etc., when compared to I.E. It's very frustrating because I can't seem to compensate for the differences to make it look right in every browser. The same thing is happening on all the pages. Other websites I have looked at don't seem to have the same problem.

    So, there must be something very fundamental that I am missing in the code.
    Any advice is most welcome. Thanks in advance.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The most common cause of this is padding and margins, whose defaults differ between browsers. To this end, a lot of web developers remove all margins and padding to start with:
    Code:
    * {
      margin: 0;
      padding: 0;
    }
    ... then specify it explicitly.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Feb 2007
    Posts
    46
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    ok , I can try that. Do I put it EXACTLY like you have above with the asterisk *, anywhere in my CSS file?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Put it at the top. This will probably seriously muck up your page design. Fix it by specifying the margins and paddings explicitly, and your page should be a lot closer in many browsers.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Feb 2007
    Posts
    46
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Ok, I made the change. It certainly helped with the positioning. Now the text is (almost) where it should be in all the different browsers.

    HOWEVER....now the page is left-justified in Mozilla and Safari, but still centered (it's supposed to be centered) in IE.

    Is there anything else I can add to the CSS statement to bring everything back to the middle of the screen?

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Try:
    Code:
    table {
      margin: 0 auto;
    }
    Some other things you might want to do are:
    1. Drop Dreamweaver. WYSIWYG editors always generate code of an inferior quality, and in this case the cruft is very clearly visible.
    2. Stop using pseudo-XHTML (served with a text/html MIME-type). This results in effectively very poor code, even if it seems to validate. You have two options: either switch to XHTML (with the application/xhtml+xml MIME type), preferably Strict since Transitional has been effectively outdated for a very long time now, or switch to HTML (with a text/html MIME type and an HTML DOCTYPE, which should be nothing less than HTML 4.01 Strict). If you take the former option you will lose support for IE, which can't parse XHTML yet.
    3. Stop using tables for layout. Table-based layouts were a hack to allow complex layouts before CSS was developed. CSS is very well established and supported now, so tables should be relegated to their proper function: displaying tabular data.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Feb 2007
    Posts
    46
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that. It seems to be getting better. Now I just have to put back some of the spacing that was originally there. No big deal.

    As for point #2 (pseudo-XHTML). ???? You're speaking Greek to me. I don't even know what all that means.

    As for point #3 (stop using tables).....easier said than done. I am totally new to CSS, so to have to re-write an entire website would be extremely difficult and time-consuming. If I knew how, I would do it, though.


    Now I only have one other major complaint, regarding scrolling when the text is longer than the defined area. Everything looks great in ie, FF, etc. Only when I view it on a MAC (Safari) do I see problems. And only for certain pages. For some reason, the background repeats. Only on this one page, and only in Safari. Other pages have scrolling text and the same definitions, yet they seem to work fine. The code I'm using for scrolling is:

    <div style="border:none; background:transparent; padding-top:0px; padding-right:10px; padding-left:4px; width:386px; height:298px; overflow:auto;">

    and the page in question is: http://www.bossteel.com/Services/Services.html

    I will also post this as a new thread, since it's really a new problem altogether.

  8. #8
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Pseudo means a mixture of two things, in this case, html and xhtml.
    you have the actual code in xhtml, but it is being sent with the html mime type.
    That's a no-no. use this:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>BOSS Steel News Page -- HOME DEPOT</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1">
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  9. #9
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What I would do is use the body onload event and just simple browser detection to place everything perfectly... But hey its just an idea...

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, "pseudo" means fake, false. In this case, the code looks like XHTML, but since it's being sent as text/html, it isn't: it's fake XHTML, pseudo-XHTML.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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