HighDots Forums  

img tag width, height attributes necessary?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss img tag width, height attributes necessary? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
DM
 
Posts: n/a

Default img tag width, height attributes necessary? - 11-04-2004 , 12:07 PM






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

dm

Reply With Quote
  #2  
Old   
Neal
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 12:28 PM






On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

Quote:
For <img> tags, are the width and height attributes necessary? Could
they just be omitted?
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).


Reply With Quote
  #3  
Old   
DM
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 12:32 PM



Neal wrote:

Quote:
On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

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


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).
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?


Reply With Quote
  #4  
Old   
Neal
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 12:33 PM



On Thu, 04 Nov 2004 13:28:12 -0500, Neal <neal413 (AT) yahoo (DOT) com> wrote:

Quote:
On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

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

They are not required but I recommend their use.
And apologies for the crosspost - followups are now set to ciwah.


Reply With Quote
  #5  
Old   
Neal
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 12:40 PM



On Thu, 04 Nov 2004 10:32:14 -0800, DM <elektrophyte-yahoo> wrote:

Quote:
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?
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.


Reply With Quote
  #6  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 12:54 PM




"DM" <elektrophyte-yahoo> wrote

Quote:
Neal wrote:

On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

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


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).

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?
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.



Reply With Quote
  #7  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 01:07 PM



*Neal* <neal413 (AT) yahoo (DOT) com>:
Quote:
On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

For <img> tags, are the width and height attributes necessary?

They are not required but I recommend their use.
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.infosystems.www.authoring.html

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


Reply With Quote
  #8  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: img tag width, height attributes necessary? - 11-04-2004 , 01:07 PM



*Neal* <neal413 (AT) yahoo (DOT) com>:
Quote:
On Thu, 04 Nov 2004 10:07:31 -0800, DM <elektrophyte-yahoo> wrote:

For <img> tags, are the width and height attributes necessary?

They are not required but I recommend their use.
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.infosystems.www.authoring.html

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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.