Local HTML vs. External CSS

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

    Local HTML vs. External CSS

    Hi...

    My external style sheet for a 200+ page site is marked up as:

    BODY, P, TABLE, TD, DIV {
    background: #ffffff;
    font-style: normal;
    font-variant: normal;
    font-weight: normal;
    font-size: 1em;
    color: #000000;
    font-family: Verdana, sans-serif, arial;
    }

    I have one solitary page on which I'd like a pale blue background, so I
    coded:

    <LINK rel="stylesheet " type="text/css" href="gz.css"
    title="default" >
    </HEAD>
    <BODY bgcolor="#80fff f" onLoad="setTime out(window.clos e, 5000)">

    The page validates as HTML 4.01 transitional, but the background stays
    white. I was under the impression that local code takes precedence.

    Do I really have to go to a CLASS or ID selector?

    --
    - Yours truly, Pete Collinson



  • Lauri Raittila

    #2
    Re: Local HTML vs. External CSS

    In article <SXCSa.30335$ye 5.7081477@news4 .srv.hcvlny.cv. net>, Peter
    Collinson wrote:[color=blue]
    > Hi...
    >
    > My external style sheet for a 200+ page site is marked up as:
    >
    > BODY, P, TABLE, TD, DIV {
    > background: #ffffff;
    > color: #000000;[/color]

    Is there some good reason to say black on white?
    [color=blue]
    > font-style: normal;
    > font-variant: normal;
    > font-weight: normal;[/color]

    Why? If someone wants her text stange looking, I bet he has very good
    reason
    [color=blue]
    > font-size: 1em;[/color]

    That is redundant too.
    [color=blue]
    > font-family: Verdana, sans-serif, arial;[/color]

    You shouldn't IMO set font to especially Verdana, nor at all.
    [color=blue]
    > }
    >
    > I have one solitary page on which I'd like a pale blue background, so I
    > coded:
    >
    > <LINK rel="stylesheet " type="text/css" href="gz.css"
    > title="default" >
    > </HEAD>
    > <BODY bgcolor="#80fff f" onLoad="setTime out(window.clos e, 5000)">[/color]

    You are making popup, aren't you? That's nasty.
    [color=blue]
    > The page validates as HTML 4.01 transitional, but the background stays
    > white. I was under the impression that local code takes precedence.[/color]

    No, inline CSS takes precedence over other CSS. HTML rules don't. That is
    somewhere in spec. CSS1 had some exeptions though.
    [color=blue]
    > Do I really have to go to a CLASS or ID selector?[/color]

    No, you need another stylesheet, or embedded style block for that.
    I'll recommend using another external CSS. You need to it to have same
    title as your normal style


    --
    Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
    Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
    tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

    Comment

    • Jim Dabell

      #3
      Re: Local HTML vs. External CSS

      Peter Collinson wrote:

      [snip][color=blue]
      > <LINK rel="stylesheet " type="text/css" href="gz.css"
      > title="default" >
      > </HEAD>
      > <BODY bgcolor="#80fff f" onLoad="setTime out(window.clos e, 5000)">
      >
      > The page validates as HTML 4.01 transitional, but the background stays
      > white. I was under the impression that local code takes precedence.[/color]

      No. style attributes are treated as though they have an id in the selector.
      This means that they have a high specificity:

      <URL:http://www.w3.org/TR/REC-CSS2/cascade.html#sp ecificity>

      You haven't used a style attribute though, you have used deprecated HTML.
      Non-CSS presentational hints have a low specificity:

      <URL:http://www.w3.org/TR/REC-CSS2/cascade.html#sp ecificity>

      In other words, use CSS instead of obsolete, presentational HTML cruft, or
      be treated like a second-class www citizen :)

      --
      Jim Dabell

      Comment

      • Chris Morris

        #4
        Re: Local HTML vs. External CSS

        Jim Dabell <jim-usenet@jimdabel l.com> writes:[color=blue]
        > No. style attributes are treated as though they have an id in the selector.
        > This means that they have a high specificity:
        >
        > <URL:http://www.w3.org/TR/REC-CSS2/cascade.html#sp ecificity>[/color]

        Though many browsers interpret their specificity as infinite rather
        than 100.

        --
        Chris

        Comment

        • Lauri Raittila

          #5
          Re: Local HTML vs. External CSS

          In article <87u19gqpuk.fsf @dinopsis.dur.a c.uk>, Chris Morris wrote:[color=blue]
          > Jim Dabell <jim-usenet@jimdabel l.com> writes:[color=green]
          > > No. style attributes are treated as though they have an id in the selector.
          > > This means that they have a high specificity:
          > >
          > > <URL:http://www.w3.org/TR/REC-CSS2/cascade.html#sp ecificity>[/color]
          >
          > Though many browsers interpret their specificity as infinite rather
          > than 100.[/color]

          Yes, and that's why spec is changed on 2.1

          --
          Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
          Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
          tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

          Comment

          • Peter Collinson

            #6
            Re: Local HTML vs. External CSS

            Lauri Raittila <lauri@raittila .cjb.net> chides...

            #> My external style sheet for a 200+ page site is marked up as:

            #> BODY, P, TABLE, TD, DIV {
            #> background: #ffffff;
            #> color: #000000;
            [color=blue]
            > Is there some good reason to say black on white?[/color]

            Absolutely... perhaps it's over-coding to you and others, but I'm
            covering all my bases, #1, and, #2, I don't like getting *** WARNING ***
            messages from the CSS Validator.

            #> font-style: normal;
            #> font-variant: normal;
            #> font-weight: normal;
            [color=blue]
            > Why? If someone wants her text stange looking,
            > I bet he has very good reason[/color]

            Hey!, c'mon, Lauri... I'm still using training wheels here. I've worked
            on an external CSS mark-up template, tweaked it into validating, and by
            Gawd and little blue pixels, I'm gonna use it 'til I am comfortable
            enough to kick the traces and fly from scratch... to mangle a metaphor
            or two.

            #> font-size: 1em;
            [color=blue]
            > That is redundant too.[/color]

            Yeah, it may be, but if I want to make a change, it's easy to do, now,
            isn't it?!?

            #> font-family: Verdana, sans-serif, arial;
            [color=blue]
            > You shouldn't IMO set font to especially Verdana, nor at all.[/color]

            Whew!, you're a mean woman!

            #> }
            #>
            #> I have one solitary page on which I'd like a pale blue
            #> background, so I coded:

            #> <LINK rel="stylesheet " type="text/css" href="gz.css"
            #> href="gz.css" title="default" >
            #> </HEAD>
            #> <BODY bgcolor="#80fff f" onLoad="setTime out(window.clos e, 5000)">
            [color=blue]
            > You are making popup, aren't you? That's nasty.[/color]

            Guilty! Guilty! Guilty!

            But a necessary adjunct of the project description is that occasional
            time-sensitive announcements be displayed for 5 seconds.

            #> The page validates as HTML 4.01 transitional, but
            #> the background stays white. I was under the
            #> impression that local code takes precedence.
            [color=blue]
            > No, inline CSS takes precedence over other CSS.
            > HTML rules don't. That is somewhere in spec.
            > CSS1 had some exeptions though.[/color]

            #> Do I really have to go to a CLASS or ID selector?
            [color=blue]
            > No, you need another stylesheet, or embedded style
            > block for that. I'll recommend using another external
            > CSS. You need to it to have same title as your normal style[/color]

            I doped out the embedded style declaration shortly after I posted the
            original question:

            <LINK rel="stylesheet " type="text/css" href="../gz.css"
            title="default" >

            <style type="text/css"><!--body { background: #80ffff; }--></style>

            </HEAD>

            It seems to achieve the desired effect.

            Thank you for your comments and suggestions.


            --
            - Yours truly, Pete Collinson










































































































            Comment

            • Lauri Raittila

              #7
              Re: Local HTML vs. External CSS

              In article <i92Ta.61688$ye 5.11938271@news 4.srv.hcvlny.cv .net>, Peter
              Collinson wrote:[color=blue]
              > Lauri Raittila <lauri@raittila .cjb.net> chides...
              >
              > #> My external style sheet for a 200+ page site is marked up as:
              >
              > #> BODY, P, TABLE, TD, DIV {
              > #> background: #ffffff;
              > #> color: #000000;
              >[color=green]
              > > Is there some good reason to say black on white?[/color]
              >
              > Absolutely... perhaps it's over-coding to you and others, but I'm
              > covering all my bases, #1, and, #2, I don't like getting *** WARNING ***
              > messages from the CSS Validator.[/color]

              But, why black on white. It is default on all CSS knowing browsers, I
              think. and when someone has changed it, he does it with good reason. I
              have, at least. And you don't get any warning, when you leave both out.
              [color=blue]
              > #> font-size: 1em;
              >[color=green]
              > > That is redundant too.[/color]
              >
              > Yeah, it may be, but if I want to make a change, it's easy to do, now,
              > isn't it?!?[/color]

              Well, you never change body font size. And em unit is buggy in some old
              browser that you don't need to care much. But using lots of redundant
              code makes it more likely to hit some bug accidentally.
              [color=blue]
              > #> font-family: Verdana, sans-serif, arial;
              >[color=green]
              > > You shouldn't IMO set font to especially Verdana, nor at all.[/color]
              >
              > Whew!, you're a mean woman![/color]

              Use google groups to find out why, and what I'm not.
              [color=blue]
              > Guilty! Guilty! Guilty!
              >
              > But a necessary adjunct of the project description is that occasional
              > time-sensitive announcements be displayed for 5 seconds.[/color]

              OK. Automatic pop-up ads don't bother me as much as banners, as I use
              browser that never shows me any pop-up ads.
              [color=blue]
              > I doped out the embedded style declaration shortly after I posted the
              > original question:[/color]

              You mean, you replaced deprecated HTML attribute using embedded CSS.
              [color=blue]
              > <LINK rel="stylesheet " type="text/css" href="../gz.css"
              > title="default" >[/color]

              That is linked/external preferred stylesheet. (whitout title it would be
              persistant, with rel="alternativ e stylesheet" it would be alternative)
              [color=blue]
              > <style type="text/css"><!--body { background: #80ffff; }--></style>[/color]

              That's called embedded stylesheet.

              <body style="none:non e">

              Here none:none is inline style. I hope this helps to understand
              teminology.


              --
              Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
              Feel free to contact me by email if your message OT, or private, etc.
              but do not CC same message to as you send to usenet.

              Comment

              • Christopher

                #8
                Re: Local HTML vs. External CSS

                Lauri Raittila <lauri@raittila .cjb.net> wrote in message
                news:<MPG.1986d e9329cbaf77989b 89@news.cis.dfn .de>...[color=blue][color=green][color=darkred]
                > > > Is there some good reason to say black on white?[/color]
                > >
                > > Absolutely... perhaps it's over-coding to you and others, but I'm
                > > covering all my bases, #1, and, #2, I don't like getting *** WARNING ***
                > > messages from the CSS Validator.[/color]
                >
                > But, why black on white. It is default on all CSS knowing browsers, I
                > think. and when someone has changed it, he does it with good reason. I
                > have, at least.[/color]

                You're probably right in general, and I don't disagree with your advice.
                But I set my defaults to black on gray. I like this best for default,
                but that doesn't mean I don't like the web to have a little variety.

                However, it seems like the safest advice is just use style sheets for
                layout, and don't specify any style settings at all. :-)

                Comment

                • Lauri Raittila

                  #9
                  Re: Local HTML vs. External CSS

                  In article <d120f138.03072 20416.7a8e5bff@ posting.google. com>, Christopher
                  wrote:[color=blue]
                  > You're probably right in general, and I don't disagree with your advice.
                  > But I set my defaults to black on gray. I like this best for default,[/color]

                  Then you see why, obviously - try something like #f0f0f0; or some
                  suitable off white on your page - it is much nicer than white. I think so
                  at least.
                  [color=blue]
                  > but that doesn't mean I don't like the web to have a little variety.[/color]

                  By using grey background on your web page would have some more variety,
                  using white, it's the same as all others, so I fail to see your point.
                  [color=blue]
                  > However, it seems like the safest advice is just use style sheets for
                  > layout, and don't specify any style settings at all. :-)[/color]

                  Of course you can use CSS, but it is not nice to use CSS to make the page
                  look as it would in browsers factory settings.

                  --
                  Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
                  Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
                  tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

                  Comment

                  • Steven Dilley

                    #10
                    Re: Local HTML vs. External CSS

                    "Peter Collinson" <bluescat@opton line.net> wrote in message
                    news:SXCSa.3033 5$ye5.7081477@n ews4.srv.hcvlny .cv.net...[color=blue]
                    > Hi...
                    >
                    > My external style sheet for a 200+ page site is marked up as:
                    >
                    > BODY, P, TABLE, TD, DIV {
                    > background: #ffffff;
                    > font-style: normal;
                    > font-variant: normal;
                    > font-weight: normal;
                    > font-size: 1em;[/color]

                    1em means the size of am 'm' character in the current font.
                    [color=blue]
                    > color: #000000;
                    > font-family: Verdana, sans-serif, arial;
                    > }
                    >
                    > I have one solitary page on which I'd like a pale blue background, so I
                    > coded:
                    >
                    > <LINK rel="stylesheet " type="text/css" href="gz.css"
                    > title="default" >
                    > </HEAD>
                    > <BODY bgcolor="#80fff f" onLoad="setTime out(window.clos e, 5000)">
                    >
                    > The page validates as HTML 4.01 transitional, but the background stays
                    > white. I was under the impression that local code takes precedence.
                    >
                    > Do I really have to go to a CLASS or ID selector?[/color]

                    No, just
                    <BODY style="backgrou nd-color:#80ffff" onLoad="setTime out(window.clos e,
                    5000)">
                    [color=blue]
                    >
                    > --
                    > - Yours truly, Pete Collinson
                    >
                    >
                    >[/color]

                    Comment

                    • Christopher

                      #11
                      Re: Local HTML vs. External CSS

                      Lauri Raittila <lauri@raittila .cjb.net> wrote in message
                      news:<MPG.19877 cd2c2e7ebaf989b 8d@news.cis.dfn .de>...[color=blue]
                      > In article <d120f138.03072 20416.7a8e5bff@ posting.google. com>, Christopher
                      > wrote:[color=green]
                      > > You're probably right in general, and I don't disagree with your advice.
                      > > But I set my defaults to black on gray. I like this best for default,[/color]
                      >
                      > Then you see why, obviously - try something like #f0f0f0; or some
                      > suitable off white on your page - it is much nicer than white. I think so
                      > at least.
                      >[color=green]
                      > > but that doesn't mean I don't like the web to have a little variety.[/color]
                      >
                      > By using grey background on your web page would have some more variety,
                      > using white, it's the same as all others, so I fail to see your point.[/color]

                      My point is that if Pete's page looks best as black on white, I want to
                      view it as black on white, even if in most cases I don't like that. This
                      is all IMHO, of course, so take it FWIW.

                      I don't have vision problems. Rest assured that if I did, I would have
                      background and color set with !important in my userContent.css file, or
                      else not be using a visual browser, and this issue would be moot. But I
                      don't. So the colors I want to see are the ones that look best for that
                      page.

                      For a lot of pages there's nothing but plain text, and I prefer black
                      on gray for that. But some pages actually do look best with a white
                      background. Maybe all his GIFs are aliased to white. Have you seen what
                      the www.google.com page looks like with a gray background? It's ugly.

                      Comment

                      • Steven Dilley

                        #12
                        Re: Local HTML vs. External CSS

                        "Alan J. Flavell" <flavell@mail.c ern.ch> wrote in message
                        news:Pine.LNX.4 .53.03072220571 40.29981@lxplus 081.cern.ch...[color=blue]
                        > On Tue, Jul 22, Steven Dilley inscribed on the eternal scroll:
                        >[color=green]
                        > > "Peter Collinson" <bluescat@opton line.net> wrote in message[/color]
                        >[color=green][color=darkred]
                        > > > font-size: 1em;[/color]
                        > >
                        > > 1em means the size of am 'm' character in the current font.[/color]
                        >
                        > What sort of light is *that* remark supposed to throw on anything?
                        >
                        > I'd suggest reading what the CSS specification has to say about em
                        > units in CSS before answering too many more questions.[/color]

                        Have I misconstrued? yet again?

                        The spec says:
                        Relative units specify a length relative to another length property.
                        The relative units 'em' and 'ex' are relative to the font size of the
                        element itself.
                        H1 { margin: 0.5em } /* ems, the height of the element's font */
                        H1 { margin: 1ex } /* x-height, ~ the height of the letter 'x' */

                        I guess the 'em' is not about the letter 'm', but the 'ex' is about the
                        letter 'x'?
                        Sincere apologies if my confusion has become contagious.
                        --
                        Steve

                        Comment

                        • Lauri Raittila

                          #13
                          Re: Local HTML vs. External CSS

                          In article <3f1ffe3c$1@10. 10.0.241>, Steven Dilley wrote:
                          [color=blue]
                          > I guess the 'em' is not about the letter 'm', but the 'ex' is about the
                          > letter 'x'?[/color]

                          Yes.

                          --
                          Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
                          Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
                          tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

                          Comment

                          Working...