Stylesheet vs. HTML tags

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Catherine Lynn Smith

    Stylesheet vs. HTML tags

    I notice as I delve deeper into CSS that many property definitions are
    redundant between the HTML tags and the CSS properties. I was
    wondering if there was a recommended preference as to which to use.
    (things such as widths/heights, background colors and images, etc.)

    I can see where either or would have benefits depending on how you
    wanted to manipulate it, but I can see in some cases where it wouldn't
    seem to matter which context you defined it and I was wondering if it
    was recommended or preferred to use one or the other or perhaps both?

    KL
  • Philipp Lenssen

    #2
    Re: Stylesheet vs. HTML tags

    Catherine Lynn Smith wrote:
    [color=blue]
    > I notice as I delve deeper into CSS that many property definitions are
    > redundant between the HTML tags and the CSS properties. I was
    > wondering if there was a recommended preference as to which to use.
    > (things such as widths/heights, background colors and images, etc.)
    >[/color]

    Ideally, CSS can completely replace layout-HTML3.2, and if possible in
    your target-browser, that's always the better way. (If you know why you
    are using CSS, then you should also know why this is better.)
    Some things cannot be implemented in CSS for certain browsers, and
    HTML-workarounds might be your choice (depending how much you/ your
    customer cares about certain layout details -- like, getting rid of a
    border around a linked image in Netscape 4 via CSS can be tough, and
    you might want to have a more relaxed doctype to support a hack --
    personally I don't care about Netscape 4 and don't use workarounds on
    private pages, but many clients will care).
    [color=blue]
    > I can see where either or would have benefits depending on how you
    > wanted to manipulate it[/color]

    So where do you see benefits in HTML tags that could be implemented as
    CSS? Mostly, they will make the site slower to manage.

    By the way, if you are just using inline-styles like <p
    style="...">... </p> indeed you might as well stick to "HTML tags" for
    layout-definiton.

    --
    Google Blogoscoped
    A daily news blog and community covering Google, search, and technology.

    Comment

    • Brian

      #3
      Re: Stylesheet vs. HTML tags

      If you feel you absolutely *must* x-post, please set followups.
      (set to ciwas)

      Catherine Lynn Smith wrote:[color=blue]
      > I notice as I delve deeper into CSS that many property definitions
      > are redundant between the HTML tags and the CSS properties. I was
      > wondering if there was a recommended preference as to which to use.
      >[/color]
      Content can only be done with html. Presentation is best done with css.
      [color=blue]
      > (things such as widths/heights[/color]

      Is it content? Image height is best done in HTML, as this is a
      content issue, and helps browsers render the document quicker. Is it
      to define the width of a paragraph or the margins of a page? That is
      presentation, and belongs in css.
      [color=blue]
      > background colors and images, etc.)[/color]

      Background stuff is presentation. Use css.
      [color=blue]
      > I can see where either or would have benefits depending on how you
      > wanted to manipulate it,[/color]

      I don't see why that would be relevant, except as a content v.
      presentation consideration.
      [color=blue]
      > but I can see in some cases where it wouldn't seem to matter which
      > context you defined it[/color]

      Such as?
      [color=blue]
      > and I was wondering if it was recommended or preferred to use one
      > or the other or perhaps both?[/color]

      Css is optional. Browsers don't need to consider it. As long as you
      don't mistake form for content -- e.g., you may want headings in dark
      green and paragraphs centered, but you don't *need* them -- then
      perhaps this fact will help you decide.

      --
      Brian
      follow the directions in my address to email me

      Comment

      • Stan Brown

        #4
        Re: Stylesheet vs. HTML tags

        In article <5fb632c2.03092 20539.3441d7ed@ posting.google. com> in
        comp.infosystem s.www.authoring.stylesheets, Catherine Lynn Smith
        <klynntg@hotmai l.com> wrote:[color=blue]
        >I notice as I delve deeper into CSS that many property definitions are
        >redundant between the HTML tags and the CSS properties. I was
        >wondering if there was a recommended preference as to which to use.[/color]

        Presentational aspects of HTML are deprecated.[1] To deprecate means
        "to attempt to ward off by prayer".

        Translation: When you have a CSS way available, it's better to use
        that than the HTML way for things like fonts, margins, colors, etc.

        This is not some airy-fairy abstract "better because it's in the
        standard". You the author get a solid benefit: you can set styles
        _once_, in a linked stylesheet, rather than have to set them on
        every single element. That means that when you want to change some
        aspect of your design (NB when, not if), you can change it once
        instead of having to edit all of your HTML pages.

        [1] http://www.w3.org/TR/html401/appendi...html#h-A.3.1.2
        and http://www.w3.org/TR/html401/appendi...s.html#h-A.3.2

        --
        Stan Brown, Oak Road Systems, Cortland County, New York, USA
        DRAGON222 menjadi link pusat terunggul Sportsbook resmi . Sistem cepat respon, tampilan sangat lancar anti lag, dan kemungkinan menang terjadi pada tekad kuat anda.

        HTML 4.01 spec: http://www.w3.org/TR/html401/
        validator: http://validator.w3.org/
        CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
        2.1 changes: http://www.w3.org/TR/CSS21/changes.html
        validator: http://jigsaw.w3.org/css-validator/

        Comment

        • C A Upsdell

          #5
          Re: Stylesheet vs. HTML tags


          "Catherine Lynn Smith" <klynntg@hotmai l.com> wrote in message
          news:5fb632c2.0 309220539.3441d 7ed@posting.goo gle.com...[color=blue]
          > I notice as I delve deeper into CSS that many property definitions are
          > redundant between the HTML tags and the CSS properties. I was
          > wondering if there was a recommended preference as to which to use.
          > (things such as widths/heights, background colors and images, etc.)[/color]

          Use CSS for control of how content should be presented. Add minimal HTML
          needed by legacy browsers (mainly NN4) for acceptable presentation.


          Comment

          Working...