HTML to CSS conversion probs: IE and Mozilla

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mikejacko86

    HTML to CSS conversion probs: IE and Mozilla

    Hello everyone!

    I have decided to convert over my table-based layout to pure CSS, to reduce
    filesize and to increase my designs flexibility.

    Apparently, I have run into quite a few problems. I wrote the code and tested
    it in IE (6), but it looks awful in Mozilla (firefox). Im quite sure my
    problems are basic, as there really isnt much code to the page. What I have is
    the bare-bones layout of my website.

    If you guys could help me in getting this to display how it should in both IE
    and Mozilla, it would be greatly appreciated. Also, any tips you can give me
    along the way would also be much appreciated.

    My code is as follows:
    --------------------------------

    <html>
    <head><title>CS S LAYOUT</title>
    </head>
    <body>
    <style type="text/css">
    <!--

    body {
    background-color : #CCCCCC;
    font-family : verdana;
    }

    #wrapper {
    margin : auto;
    text-align : center;
    font-size : 10px;
    }

    #header {
    text-align : left;
    background-color : white;
    padding : 5px;
    width : 693px;
    }

    ..flashBanner {
    width : 683px;
    height : 198px;
    border : solid #CCCCCC 1px;
    }

    #navigation {
    }

    #navlist {
    margin : 0;
    padding : 0;
    padding-top : 5px;
    }

    #navlist li {
    display : inline;
    list-style-type : none;
    padding-right : 10px;
    }

    #centerSection {
    width : 693px;
    }

    #headlines {
    margin-top : 5px;
    text-align : left;
    background-color : white;
    padding : 5px;
    width : 230px;
    height : 180px;
    float : left;
    }

    #loginBox {
    text-align : left;
    width : 458px;
    float : right;
    }

    #loginInfo {
    margin-top : 5px;
    background-color : white;
    padding : 5px;
    }

    #loginGraphic {
    margin-top : 5px;
    background-color : white;
    padding : 5px;
    height : 153px;
    }

    #bottomSection {
    text-align : left;
    width : 693px;
    margin-top : 5px;
    }

    #latestPostings {
    background-color : white;
    width : 340px;
    height : 130px;
    padding : 5px;
    float : left;
    }

    #chatroom {
    background-color : white;
    width : 348px;
    height : 130px;
    padding : 5px;
    float : right;
    }

    #footer {
    background-color : white;
    width : 693px;
    padding : 5px;
    text-align : left;
    margin-top : 5px;
    }

    -->
    </style>
    <div id="wrapper">
    <div id="header">
    <div class="flashBan ner">
    </div>
    <div class="navigati on">
    <ul id="navlist">
    <li>HOME</li>
    <li>SUPPORT</li>
    <li>DISCUSSIO N</li>
    </ul>
    </div>
    </div>
    <div id="centerSecti on">
    <div id="headlines" >
    ddkjdl<br />affdaf
    </div>
    <div id="loginBox">
    <div id="loginInfo" >
    mjhkjh
    </div>
    <div id="loginGraphi c">
    hkjh
    </div>
    </div>
    </div>
    <div id="bottomSecti on">
    <div id="latestPosti ngs">
    latest postings
    </div>
    <div id="chatroom">
    blah blah
    </div>
    </div>
    <div id="footer">
    ©2004
    </div>
    </div>
    </body>
    </html>
  • Brian

    #2
    Re: HTML to CSS conversion probs: IE and Mozilla

    Mikejacko86 wrote:[color=blue]
    > Hello everyone!
    >
    > I have decided to convert over my table-based layout to pure CSS, to reduce
    > filesize and to increase my designs flexibility.[/color]

    Please see this link for some help:



    --
    Brian (remove ".invalid" to email me)

    Comment

    • kaeli

      #3
      Re: HTML to CSS conversion probs: IE and Mozilla

      In article <20040609224410 .24939.00000561 @mb-m21.aol.com>, mikejacko86
      @aol.com enlightened us with...[color=blue]
      > Apparently, I have run into quite a few problems. I wrote the code and tested
      > it in IE (6), but it looks awful in Mozilla (firefox). Im quite sure my
      > problems are basic, as there really isnt much code to the page. What I have is
      > the bare-bones layout of my website.
      >[/color]

      One thing that matters a lot in many cases is the doctype, which I don't
      see here. A doctype allows you to properly validate your html, which you
      should always do.
      It also tells IE (and other browsers?) whether to render in quirks mode
      or not.
      The doctype I usually use is
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
      "http://www.w3.org/TR/REC-html40/loose.dtd">

      Once I gave your page the doctype, and tested it, it looks like crap in
      IE, too. :)
      When I took it out, it looked nice.

      So, your problem is that without the doctype, IE is rendering in quirks
      mode. Mozilla is rendering normally without the doctype.

      Give your page that doctype and try again.
      In case you're unaware, the doctype goes as the very first line in the
      file.
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
      "http://www.w3.org/TR/REC-html40/loose.dtd">
      <html>
      <head>
      <title> New Document </title>
      and so on.

      When you're done, go validate your html.
      W3C's easy-to-use markup validation service, based on SGML and XML parsers.


      HTH

      --
      --
      ~kaeli~
      The best part of having kids is giving them back to their
      parents.



      Comment

      • Mark Tranchant

        #4
        Re: HTML to CSS conversion probs: IE and Mozilla

        kaeli wrote:
        [color=blue]
        > One thing that matters a lot in many cases is the doctype, which I don't
        > see here. A doctype allows you to properly validate your html, which you
        > should always do.[/color]

        Good advice.
        [color=blue]
        > It also tells IE (and other browsers?) whether to render in quirks mode
        > or not.[/color]

        Correct information, unfortunately.
        [color=blue]
        > The doctype I usually use is
        > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
        > "http://www.w3.org/TR/REC-html40/loose.dtd">[/color]

        Poor choice. Use 4.01 Strict.

        --
        Mark.

        Comment

        • Neal

          #5
          Re: HTML to CSS conversion probs: IE and Mozilla

          On Thu, 10 Jun 2004 14:50:33 +0100, Mark Tranchant
          <mark@tranchant .plus.com> wrote:
          [color=blue]
          > kaeli wrote:[color=green]
          >> The doctype I usually use is
          >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
          >> "http://www.w3.org/TR/REC-html40/loose.dtd">[/color][/color]

          I can't offer what advantages using:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">

          would give, but it's my understanding that there are advantages. Anyway...
          [color=blue]
          > Poor choice. Use 4.01 Strict.[/color]

          I agree - which is:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">

          Transitional is useful only if you require the use of deprecated elements
          and attributes. If you can get by without them, use strict.

          Comment

          • kaeli

            #6
            Re: HTML to CSS conversion probs: IE and Mozilla

            In article <dGZxc.13270$NK 4.1916780@stone s.force9.net>,
            mark@tranchant. plus.com enlightened us with...[color=blue]
            >[color=green]
            > > The doctype I usually use is
            > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            > > "http://www.w3.org/TR/REC-html40/loose.dtd">[/color]
            >
            > Poor choice. Use 4.01 Strict.
            >
            >[/color]

            I use transitional so I have the leeway to put presentational stuff and
            deprecated elements in the markup if I need/want to to support older
            browsers or if I want to be lazy. *g*
            And god forbid I use someone else's code for something - all the free
            tool sites use this doctype and I don't feel like changing their code to
            be compliant to strict. Actually, I think the vast majority of web sites
            with anything more than text content use it.

            --
            --
            ~kaeli~
            The more ridiculous a belief system, the higher probability
            of its success.



            Comment

            • Mikejacko86

              #7
              Re: HTML to CSS conversion probs: IE and Mozilla

              Hey guys,

              Thanks for the advice. I have sinced worked on my site and have got it to
              display properly in both IE and Mozilla! The HTML and CSS also validates
              perfectly.

              What I am now going to do (and should have done at the start) is to work on
              making my markup more semantically correct, I currently cant see anything wrong
              with it... someone told me it was "div soup," but I never knew <div> had a real
              semantic purpose other than for what I am using it for, division.

              Comment

              • Neal

                #8
                Re: HTML to CSS conversion probs: IE and Mozilla

                On 10 Jun 2004 18:54:48 GMT, Mikejacko86 <mikejacko86@ao l.com> wrote:
                [color=blue]
                > Hey guys,
                >
                > Thanks for the advice. I have sinced worked on my site and have got it to
                > display properly in both IE and Mozilla! The HTML and CSS also validates
                > perfectly.
                >
                > What I am now going to do (and should have done at the start) is to work
                > on
                > making my markup more semantically correct, I currently cant see
                > anything wrong
                > with it... someone told me it was "div soup," but I never knew <div> had
                > a real
                > semantic purpose other than for what I am using it for, division.[/color]


                Post the URL, we can help...

                Comment

                • Mikejacko86

                  #9
                  Re: HTML to CSS conversion probs: IE and Mozilla

                  >Post the URL, we can help...


                  Comment

                  • Neal

                    #10
                    Re: HTML to CSS conversion probs: IE and Mozilla

                    On 10 Jun 2004 21:18:59 GMT, Mikejacko86 <mikejacko86@ao l.com> wrote:
                    [color=blue][color=green]
                    >> Post the URL, we can help...[/color]
                    >
                    > http://www.mjnewsonline.com/temp/css[/color]

                    I wopuldn't call this "div soup" - but in order to replicate the
                    table-based design, you've needed to do all this. Your divs are semantic
                    and sensible IMO.

                    With the HTML, one complaint is that you've overused h1. I reserve h1 for
                    the heading for the whole page. As your headings top specific sections,
                    they'd be h2. Your "flashbanne r" is really the page heading. I'd include a
                    text header as an h1 here, and set it absolutely positioned offscreen
                    (left: 1000px for example), for the sake of Google and accessibility.

                    In addition, I'd reserve the use of the p element for true paragraphs.
                    None of the uses of p in your document are really paragraphs, they're
                    short strings, not even sentences. Ex. <div id="loginInfo"> <p>You are not
                    currently logged in.</p></div> : simply use the div, no need for p here.

                    Once the HTML is semantically correct, we move on to the CSS.

                    font-family : verdana, serif;

                    Odd choice. Verdana is a poor web font unless used at larger sizes, as any
                    replacement has such a smaller aspect it will be illegible at a reasonable
                    body text size for Verdana.
                    http://www.xs4all.nl/~sbpoley/webmatters/verdana.html . For general body
                    text it's best to use a more common font which is closer to what common
                    user default font aspects are. (It's impossiblr to be precise in this, but
                    you can come close.)

                    font-size : .6em;

                    This is less than 2/3 the size of the user's preferred (or accustomed)
                    text size. It will likely be too small to read. Especially if the user
                    does not have Verdana - which is pretty small itself at .6em - this is
                    going to be impossible to read.

                    Summing both the above up, I think this would be an improvement in
                    usability: font-family : sans-serif; and no font-size declaration for
                    body. This may be constrained a bit by your box widths - but at least it
                    can be read.

                    Although your specific design demands would make this very difficult,
                    avoiding fixed-width layouts is a generally good idea for exactly the
                    reasons I just described. Not knowing how the content is being included, I
                    can't advise you on this.

                    For a fixed-width design, it's pretty smart. For many users, it's usable,
                    but it's still not quite as good as it could be.

                    Comment

                    • Mikejacko86

                      #11
                      Re: HTML to CSS conversion probs: IE and Mozilla

                      >From: Neal

                      Great advice! Exactly what I was looking for.
                      [color=blue]
                      >With the HTML, one complaint is that you've overused h1.[/color]

                      :) I changed did this before reading this posting, so Im glad Im on the right
                      track.
                      [color=blue]
                      >In addition, I'd reserve the use of the p element for true paragraphs.[/color]

                      Ah, here is one thing that I have been unsure about, the semantic value of
                      <span>. See, I cant just have the text within the <div>'s because I need to add
                      padding, for this the text needs to be contained within an element as I dont
                      want to add padding to the <div>'s directly, as it adds to the width/height of
                      the content box, which just confuses the logic of my layout. So, should <span>
                      be used in these cases?
                      [color=blue]
                      >I think this would be an improvement in
                      >usability: font-family : sans-serif;[/color]

                      Great idea, after having tried this I really like this font.
                      [color=blue]
                      >font-size : .6em;
                      >
                      >This is less than 2/3 the size of the user's preferred (or accustomed)
                      >text size. It will likely be too small to read.[/color]

                      My problem here is that it is my desired size for the websites design --
                      atleast for the lists contained within some of the content boxes.
                      [color=blue]
                      >Although your specific design demands would make this very difficult,
                      >avoiding fixed-width layouts is a generally good idea for exactly the
                      >reasons I just described.[/color]

                      The main reason why I cant use a liguid layout is because of the flash header I
                      am using.
                      [color=blue]
                      >For a fixed-width design, it's pretty smart.[/color]

                      Thanks!

                      [color=blue]
                      >For many users, it's usable,
                      >but it's still not quite as good as it could be.[/color]

                      Getting there. ;)

                      Look forward to your reply, also check out the URL again, I have made some
                      changes.Thank you.

                      Comment

                      • Neal

                        #12
                        Re: HTML to CSS conversion probs: IE and Mozilla

                        On 11 Jun 2004 21:08:33 GMT, Mikejacko86 <mikejacko86@ao l.com> wrote:
                        [color=blue][color=green]
                        >> In addition, I'd reserve the use of the p element for true paragraphs.[/color]
                        >
                        > Ah, here is one thing that I have been unsure about, the semantic value
                        > of
                        > <span>.[/color]

                        Easy. It's semantically neutral. If it isn't better described with other
                        markup, div and span are fine.

                        But span is inline, it would not replace p. Div would. Span within a div,
                        ok.
                        [color=blue]
                        > See, I cant just have the text within the <div>'s because I need to add
                        > padding, for this the text needs to be contained within an element as I
                        > dont
                        > want to add padding to the <div>'s directly, as it adds to the
                        > width/height of
                        > the content box, which just confuses the logic of my layout. So, should
                        > <span>
                        > be used in these cases?[/color]

                        No, use another div.
                        [color=blue][color=green]
                        >> I think this would be an improvement in
                        >> usability: font-family : sans-serif;[/color]
                        >
                        > Great idea, after having tried this I really like this font.[/color]

                        Actually, that's not a font, that's allowing the user to use their default
                        sans-serif font. By declaring this, they'll always have the font to do the
                        job!
                        [color=blue][color=green]
                        >> font-size : .6em;
                        >>
                        >> This is less than 2/3 the size of the user's preferred (or accustomed)
                        >> text size. It will likely be too small to read.[/color]
                        >
                        > My problem here is that it is my desired size for the websites design --
                        > atleast for the lists contained within some of the content boxes.[/color]

                        It is a problem. As an author, I'd rather have the problem of making it
                        work somehow than have the user have the problem of not finding my site
                        usable. Follow the money, you know.

                        I swear, you're better off tweaking the design to accomodate legible text
                        than to tweak the text to match an arbitrary design decision. Content is
                        king, and the text is the content delivery. So your primary goal is to
                        make the content usable, hmm?
                        [color=blue][color=green]
                        >> Although your specific design demands would make this very difficult,
                        >> avoiding fixed-width layouts is a generally good idea for exactly the
                        >> reasons I just described.[/color]
                        >
                        > The main reason why I cant use a liguid layout is because of the flash
                        > header I
                        > am using.[/color]

                        Well, consider making the flash header only 580px wide and centering it
                        within a div with a matching background-color. That way, it can flex to
                        whatever viewport width the user prefers.

                        The side benefit here is that the flash header will have less weight,
                        which means a quicker download.

                        Comment

                        • Mikejacko86

                          #13
                          Re: HTML to CSS conversion probs: IE and Mozilla

                          >Easy. It's semantically neutral. If it isn't better described with other[color=blue]
                          >markup, div and span are fine.
                          >
                          >But span is inline, it would not replace p. Div would. Span within a div,
                          >ok.[/color]

                          OK, great, thanks. :)
                          [color=blue]
                          >Actually, that's not a font, that's allowing the user to use their default
                          >sans-serif font. By declaring this, they'll always have the font to do the
                          >job![/color]

                          :) I have now set this to: "arial, sans serif;"
                          [color=blue]
                          >So your primary goal is to
                          >make the content usable, hmm?[/color]

                          I upped the font-size a bit and I think its now very legible.
                          [color=blue]
                          >Well, consider making the flash header only 580px wide and centering it
                          >within a div with a matching background-color. That way, it can flex to
                          >whatever viewport width the user prefers.[/color]

                          Im not too sure about this, I really like the look and feel of the site as it
                          is as a fixed-width site. I know that many pro CSS designers have made this
                          decision too, like ALA for example.

                          Thank you very much for your help! Check out the updates and tell me what you
                          think.

                          Comment

                          Working...