img tag width, height attributes necessary?

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

    img tag width, height attributes necessary?

    For <img> tags, are the width and height attributes necessary? Could they just
    be omitted?

    dm
  • Neal

    #2
    Re: img tag width, height attributes necessary?

    On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
    [color=blue]
    > For <img> tags, are the width and height attributes necessary? Could
    > they just be omitted?[/color]

    They are not required but I recommend their use.

    Without this information in the HTML, the UA cannot account for the
    viewport space needed for the image. As a result, it happens that if the
    user is reading below the image, suddenly the UA discovers the dimensions
    and the whole page jumps disconcertingly .

    And it's important to be sure the values of height and width are the exact
    pixel dimension of the image being used. Don't resize images in the
    browser, it leads to either a heftier download than is needed (when HTML
    reduces size) or a pixellated ugly image (when HTML increases size).

    Comment

    • Neal

      #3
      Re: img tag width, height attributes necessary?

      On Thu, 04 Nov 2004 13:28:12 -0500, Neal <neal413@yahoo. com> wrote:
      [color=blue]
      > On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
      >[color=green]
      >> For <img> tags, are the width and height attributes necessary? Could
      >> they just be omitted?[/color]
      >
      > They are not required but I recommend their use.[/color]

      And apologies for the crosspost - followups are now set to ciwah.

      Comment

      • DM

        #4
        Re: img tag width, height attributes necessary?

        Neal wrote:
        [color=blue]
        > On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
        >[color=green]
        >> For <img> tags, are the width and height attributes necessary? Could
        >> they just be omitted?[/color]
        >
        >
        > They are not required but I recommend their use.
        >
        > Without this information in the HTML, the UA cannot account for the
        > viewport space needed for the image. As a result, it happens that if the
        > user is reading below the image, suddenly the UA discovers the
        > dimensions and the whole page jumps disconcertingly .
        >
        > And it's important to be sure the values of height and width are the
        > exact pixel dimension of the image being used. Don't resize images in
        > the browser, it leads to either a heftier download than is needed (when
        > HTML reduces size) or a pixellated ugly image (when HTML increases size).[/color]

        Thanks for the reply. On a related question, if you do provide width and height
        attributes, does it matter whether you use <img> tag or CSS attributes?

        Comment

        • Neal

          #5
          Re: img tag width, height attributes necessary?

          On Thu, 04 Nov 2004 10:32:14 -0800, DM <elektrophyte-yahoo> wrote:
          [color=blue]
          > Thanks for the reply. On a related question, if you do provide width and
          > height attributes, does it matter whether you use <img> tag or CSS
          > attributes?[/color]

          If you provide the height and width in content, the CSS values are not
          necessary. Remember that a page can be loaded with images and without CSS.
          Whenever the image is part of the HTML, the height and width should be in
          the HTML as well.

          Comment

          • Harlan Messinger

            #6
            Re: img tag width, height attributes necessary?


            "DM" <elektrophyte-yahoo> wrote in message
            news:418a7601$0 $799$2c56edd9@n ews.cablerocket .com...[color=blue]
            > Neal wrote:
            >[color=green]
            > > On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
            > >[color=darkred]
            > >> For <img> tags, are the width and height attributes necessary? Could
            > >> they just be omitted?[/color]
            > >
            > >
            > > They are not required but I recommend their use.
            > >
            > > Without this information in the HTML, the UA cannot account for the
            > > viewport space needed for the image. As a result, it happens that if the
            > > user is reading below the image, suddenly the UA discovers the
            > > dimensions and the whole page jumps disconcertingly .
            > >
            > > And it's important to be sure the values of height and width are the
            > > exact pixel dimension of the image being used. Don't resize images in
            > > the browser, it leads to either a heftier download than is needed (when
            > > HTML reduces size) or a pixellated ugly image (when HTML increases[/color][/color]
            size).[color=blue]
            >
            > Thanks for the reply. On a related question, if you do provide width and[/color]
            height[color=blue]
            > attributes, does it matter whether you use <img> tag or CSS attributes?[/color]

            You should do it in the HTML. The height and width of an image are actual
            attributes of the image, they're not presentational suggestions. And then
            there's no need to do it in the CSS.

            Comment

            • Christoph Paeper

              #7
              Re: img tag width, height attributes necessary?

              *Neal* <neal413@yahoo. com>:[color=blue]
              > On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
              >[color=green]
              >> For <img> tags, are the width and height attributes necessary?[/color]
              >
              > They are not required but I recommend their use.[/color]

              For purely decorative images, which correctly have empty 'alt' texts, they
              should be omitted, though. Not all of these should or could be included
              per CSS.

              F'up2 comp.infosystem s.www.authoring.html

              --
              Useless Fact #4:
              Coca Cola was originally green.

              Comment

              • Christoph Paeper

                #8
                Re: img tag width, height attributes necessary?

                *Neal* <neal413@yahoo. com>:[color=blue]
                > On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:
                >[color=green]
                >> For <img> tags, are the width and height attributes necessary?[/color]
                >
                > They are not required but I recommend their use.[/color]

                For purely decorative images, which correctly have empty 'alt' texts, they
                should be omitted, though. Not all of these should or could be included
                per CSS.

                F'up2 comp.infosystem s.www.authoring.html

                --
                Useless Fact #9:
                Percentage of Africa that is wilderness: ca. 28%.
                Percentage of North America that is wilderness: ca. 38%.

                Comment

                Working...