Resetting default <IMG> HEIGHT and WIDTH attributes

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

    Resetting default <IMG> HEIGHT and WIDTH attributes

    If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
    determined so as to maintain the image's aspect ratio.

    Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.

    What is the value of an unspecified HEIGHT or WIDTH attribute. How do I
    dynamically set the attribute to unspecified, after having previously used
    the <IMG> with explicit HEIGHT and WIDTH attributes?

    - David



  • Randy Webb

    #2
    Re: Resetting default &lt;IMG&gt; HEIGHT and WIDTH attributes

    David D. wrote:
    [color=blue]
    > If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
    > determined so as to maintain the image's aspect ratio.[/color]

    By reading the file itself.
    [color=blue]
    > Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.
    >
    > What is the value of an unspecified HEIGHT or WIDTH attribute.[/color]

    Its undefined and the browser reads the image file to get its width
    and/or height.
    [color=blue]
    > How do I dynamically set the attribute to unspecified, after
    > having previously used the <IMG> with explicit HEIGHT and WIDTH
    > attributes?
    >[/color]

    Simply put, you don't reliably do it. What exactly are you trying to do
    though? Sounds like you are trying to make a thumbnail page where the
    images swap out by resizing them??


    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/

    Comment

    • Fox

      #3
      Re: Resetting default &lt;IMG&gt; HEIGHT and WIDTH attributes



      "David D." wrote:[color=blue]
      >
      > If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally
      > determined so as to maintain the image's aspect ratio.
      >
      > Aspect ratio is also preserved if HEIGHT but not WIDTH is specified.
      >
      > What is the value of an unspecified HEIGHT or WIDTH attribute. How do I
      > dynamically set the attribute to unspecified, after having previously used
      > the <IMG> with explicit HEIGHT and WIDTH attributes?[/color]

      WIDTH="100%" HEIGHT="100%"
      [color=blue]
      >
      > - David[/color]

      Comment

      Working...