Loading ...
Sorry, an error occurred while loading the content.

Image Tags and Carriage Returns

Expand Messages
  • mikew@wtribe.com
    After trying to figure this out for a long, long time, I almost accidentally discovered that inserting a carriage break before or after an image tag will
    Message 1 of 5 , May 31, 2001
    • 0 Attachment
      After trying to figure this out for a long, long time, I almost
      accidentally discovered that inserting a carriage break before or
      after an image tag will change the way that the image is displayed in
      IE or NS.

      For example:

      <IMG SRC="a.jpg"><IMG SRC="b.jpg">

      displays differently than:

      <IMG SRC="a.jpg">
      <IMG SRC="b.jpg">

      (The second example has a 4 pixel gap between the images, while the
      first example doesn't.)

      Here's another example:

      <TD><IMG SRC="a.jpg"></TD>
      <TD><IMG SRC="b.jpg"></TD>

      displays differently than:

      <TD>
      <IMG SRC="a.jpg">
      </TD>
      <TD>
      <IMG SRC="b.jpg">
      </TD>

      (Again, the second example has a 4 pixel gap between the images, even
      with cellpadding and cellspacing set to zero in the <TABLE> tag.)

      Can anyone explain this to me or provide me with some related tips?

      Thanks,

      Mike Wilkinson
    • Lotta
      Hi Mike, ... ... It isn t as peculiar as it may seem. The browser handles images much in the same way as it would text. (Picture this is a
      Message 2 of 5 , May 31, 2001
      • 0 Attachment
        Hi Mike,

        >After trying to figure this out for a long, long time, I almost
        >accidentally discovered that inserting a carriage break before or
        >after an image tag will change the way that the image is displayed in
        >IE or NS.

        <space saving snip>

        >Can anyone explain this to me or provide me with some related tips?

        It isn't as peculiar as it may seem. The browser handles images much in the
        same way as it would text.

        (Picture this is a HTML document for awhile)

        blah blah

        displays with a blank space between the words and so will

        <IMG> <IMG>

        When it comes to tables it's again a matter of the browsers way to handle
        whitespace. Especially NS is tricky with this. To make sure you don't get a
        gap between the image and the table border write the code on one long line,
        at least for the <TD><IMG><TD> part. If you have a table with many cells
        with images in them it may be easiest to compress the code for the whole
        table to one line.

        BTW it's the same thing that causes those nasty blue dashes after links.

        <a href="">linktext </a>

        The browser sees the blank space as a part of the link text and obediently
        underlines it.

        Did it help? :)

        Lotta
      • Lotta
        Mike, I made a typo. ... Was of course to be: And I forgot to say that I made double spaces to make it easier to see. One space is enough for it
        Message 3 of 5 , May 31, 2001
        • 0 Attachment
          Mike,

          I made a typo.

          > <TD><IMG><TD>

          Was of course to be:

          <TD><IMG></TD>

          And I forgot to say that I made double spaces to make it easier to see. One
          space is enough for it to show up in the browser.

          One shouldn't write when one ought to sleep.

          Goodnight,
          Lotta
        • Stephen Riddle
          Hi Mike, I m not sure if I can explain it but that has never stopped me before. The browser always condenses white space unless told to do different. If you
          Message 4 of 5 , May 31, 2001
          • 0 Attachment
            Hi Mike,
            I'm not sure if I can explain it but that has never stopped me before.

            The browser always condenses white space unless told to do different. If
            you have this line somewhere in your document:
            I am a
            long line!
            It will be rendered:
            I am a long line.

            However if you have this line:
            I a m a l o n g l i n e .
            The browser will render it as it is typed.
            In html, everything is basically a letter.
            If you have an image 30 pixels high and wide, in a line of text, unless
            you use attributes or css or some other such command, the browser moves
            the line of text down far enough to fit this huge letter (as if it were
            a really fancy capital letter.)
            So your first example,
            <IMG SRC="a.jpg"><IMG SRC="b.jpg">,
            is rendered as if it is a two letter word made of two images. Your
            second example,
            <IMG SRC="a.jpg">
            <IMG SRC="b.jpg">,
            is rendered as if it is two one letter words each consisting of an
            image.

            When you have an element, links are notorious for this, and there is
            white space between the closing bracket of the opening tag and the
            content of the element, the white space is considered part of the
            element. That's why you see links with blue lines extending from the
            bottom edges.
            I think that is basically it. When I first learned HTML, I was told
            that white space was negligible.
            You found out it is not.
            Keep on learning, and may all your lessons be fun!
            Stephen
          • Yehuda Katz
            Hi, HTML translates carriage return as a space. In most cases it passes unnoticable, but try this: HT ML and you get HT ML. The same applies for images.
            Message 5 of 5 , Jun 1, 2001
            • 0 Attachment
              Hi,

              HTML translates carriage return as a space. In most cases it passes
              unnoticable, but try this:

              HT
              ML

              and you get HT ML.

              The same applies for images.

              Yehuda, Israel


              >From: mikew@...
              >Reply-To: ntb-html@yahoogroups.com
              >To: ntb-html@yahoogroups.com
              >Subject: [NH] Image Tags and Carriage Returns
              >Date: Thu, 31 May 2001 21:30:36 -0000
              >
              >After trying to figure this out for a long, long time, I almost
              >accidentally discovered that inserting a carriage break before or
              >after an image tag will change the way that the image is displayed in
              >IE or NS.
              >
              >For example:
              >
              ><IMG SRC="a.jpg"><IMG SRC="b.jpg">
              >
              >displays differently than:
              >
              ><IMG SRC="a.jpg">
              ><IMG SRC="b.jpg">
              >
              >(The second example has a 4 pixel gap between the images, while the
              >first example doesn't.)
              >
              >Here's another example:
              >
              ><TD><IMG SRC="a.jpg"></TD>
              ><TD><IMG SRC="b.jpg"></TD>
              >
              >displays differently than:
              >
              ><TD>
              ><IMG SRC="a.jpg">
              ></TD>
              ><TD>
              ><IMG SRC="b.jpg">
              ></TD>
              >
              >(Again, the second example has a 4 pixel gap between the images, even
              >with cellpadding and cellspacing set to zero in the <TABLE> tag.)
              >
              >Can anyone explain this to me or provide me with some related tips?
              >
              >Thanks,
              >
              >Mike Wilkinson
              >

              _________________________________________________________________________
              Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
            Your message has been successfully submitted and would be delivered to recipients shortly.