Re: [css-d] Necessity of width and height attributes within img
2006/10/16, [EMAIL PROTECTED] : Good afternoon, The Government of Canada is rolling out its next iteration of guidelines that governmental departments must adhere to, and I'm just in the process of writing up a constructive critique. One of the things I would like to see is height and width removed from image tags and instead be defined in the CSS. I have a number of recurring icons throughout my sites, and in the past I have been able to change the icons by simply overwriting the old version with the new one and updating the dimensions in the CSS accordingly. However, some other developers are leery of leaving them off. Are there any drawbacks or best practices I should know about? Good afternoon, CMS are necesseraly used by governmental departments. IMHO, the major drawback of your solution would be to prevent users of such tools to choose the size of the image they wish to include in a page (thanks be to God, CMS users cannot modify a style sheet...) This solution might be good in many cases, but a disaster in some other situations. Amitiés -- Philippe DE MOURA phdm __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Necessity of width and height attributes within img
All the height/width really does is set up a block of space that browser knows is being used by the image, for the most part it can stay or go. I couldn't find the page @ w3c.org but 23schools.com has height and width both listed as optional attributes, with the only required ones being src and alt. [EMAIL PROTECTED] wrote: One of the things I would like to see is height and width removed from image tags and instead be defined in the CSS. I have a number of recurring icons throughout my sites, and in the past I have been able to change the icons by simply overwriting the old version with the new one and updating the dimensions in the CSS accordingly. __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Necessity of width and height attributes within img
[EMAIL PROTECTED] wrote: One of the things I would like to see is height and width removed from image tags and instead be defined in the CSS. I have a number of recurring icons throughout my sites, and in the past I have been able to change the icons by simply overwriting the old version with the new one and updating the dimensions in the CSS accordingly. The presence of HTML width/height attributes don't prevent us from changing image-dimensions through CSS, so there's no conflict between HTML attributes and CSS here. Those HTML attributes can also be left out at will, so I simply can't see any problems in keeping them in some guidelines - unless those guidelines are saying that those attributes *must* be used in a certain way, which deviates from standards. However, some other developers are leery of leaving them off. Are there any drawbacks or best practices I should know about? I have noticed a few browser-bugs that may disturb layouts where images have no declared dimensions. Other than that there's only those rare cases where images are resized in CSS, and the user for whatever reason turns CSS off... regards Georg -- http://www.gunlaug.no __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Necessity of width and height attributes within img
2006/10/17, Mark J. Reed: The reason it has long been recommended to include width and height attributes in image elements is to assist the browser in rendering the page. (...) Modern browsers are quite adept at shuffling things around on the page after the initial rendering, so my vote would be to leave off the width and height specifications entirely. Mark, You are right, modern browsers don't really need the size of the images in pixels, but don't forget that the width and height of images are not nesseraly given in pixels. It can be, for instance, expressed in ems or in % (of the width of its container), Example, look at: http://www.htmldog.com/articles/elasticdesign/demo/ the first image on his page has: img alt=Elastic image src=icicles.jpg class=image id=image1 in the stylesheet: .image { width: 30em; height: 15em; margin: 0 2em 1em 2em; border: 1px solid #ccc; } The size of the image will change with the default size of your font. You could also have something like: .image { width: 90%; height: auto; } There is no other way to tell the brother what to do here. You do need to specify at least a width or a height either in the style sheet or in the source of your HTML document. Regards -- Philippe DE MOURA phdm __ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/