PDA

View Full Version : image dimesions necessary in body code?


bazz
05-11-2003, 01:07 AM
Hi, I 've tried the search engine but with no joy.

I have inserted my logo into the body of my html pages like this below. It it necessary for other brwosers than IE6 that I also add the dimensions? I ask because in the future if I change the size of the logo, I dont want to have to redo all of about 400 pages.
And should I use a closing tag somwhere?

<img class="sitelogo" src="images/wslogovsm.gif">
Thanks

bradyj
05-11-2003, 01:44 AM
If you're using an editor like Dreamweaver you should be able to change tags sitewide, so that shouldn't be a problem -- I also wonder if you are going to update the site in the future, what's changing one more tag (even though, I agree, it can be a pain)?

I don't know as much as the moderators here, but I have seen that putting dimensions in my tags for images has speeded up downloading for the layout of the pages... for larger images, it can be helpful if I use a lower res pre-loaded image.

BloodXero
05-11-2003, 05:34 AM
no it is not needed. if they're not used then the true size of the image will be used. if you use them it will make it fit but it might be distorted if it is a great dimension difference. so just crop it down before you do that.

bradyj
05-11-2003, 05:41 AM
BloodXero -- so you're saying, basically, that if you post a different image size in the text then the actual image size, it will distort the graphic... that makes sense, I was just trying to understand that better - but I was aware of that.

Then it's not needed? Cool, I'll quit doing that too then:)

bazz
05-11-2003, 10:43 AM
excellent news BloodXero :cool:

I had always thought that they way to do it 'properly' was to make the image the size that it was supposed to be on the page and not to rely on dimensions in the script, to make it the desired size. But I have been made more aware of cross-browser considerations since finding you guys here and had a panic last night when I imagined that some browsers might think that my image was supposed to be the size of the window :eek:

Still I now know I needn't wory about that bit of my script then :thumbsup:

BloodXero
05-11-2003, 04:27 PM
well it matters which way you like it. if you leave out the properties in the tag it will be the image size but sometimes it might be too big or small. if you put in the tag properties and the w:h ratio of the real image is a good ways away from the w:h ratio of the tag than it will be the exact right size you need but it can get severely distorted. if you dont have any good image editing program like PSP or PS7 than a little bit of distortion is ok. but if it gets out of hand and there is no possible way to make it any better i suggest you find another image or remake it. but if you put in the tag properties and they are the same as the image size nothing will happen. so if you made it to fit in perfectly you can just leave out the width and height.

pardicity3
05-11-2003, 07:15 PM
In HTML there is no ending tag for <img>, but in XHTML you need to end the <img> tag (along with all empty tags) by adding a trailing slash: <img src="blah" />.

About specifying width and height: It is recommended that you do so if your layout depends on your image size. If you specify the width and height then even if your image cannot be found for some reason the "dead-image" box will be the size that the normal image should be. I hope you understood that as I am having a terrible time explaining this today :(.

Another reason why it is nice to specify width and height is that on slower modems (i.e. 56k and lower) the images will get bigger as they load. If you have a 400x400 image it will grow from 0x400 to 400x400. Thus if you have any text on the page around the image, it is likely to jump around and be nice and annoying.

If you are worried about changing the image tag for a bunch of pages you could look into some form of including. Using PHP or SSI you could easily include a file that had the image information in there. Then all you would have to do is change the one file with the image info in it.

brothercake
05-11-2003, 07:48 PM
pardicity3 is right - not only does specifying the dimensions ensure that the bounding box is the right size even if it can't be found, it also speeds up the download and rendering process - a page will render more quickly if you specify the initial width and height of images because then it doesn't have to redraw after the images have been loaded.

Always specify the dimensions.

BloodXero
05-11-2003, 08:18 PM
ya i guess they're right. if its not important for exact layout its not needed but if you want things in one place with one size and one size only it might be a good idea to use it.

bazz
05-11-2003, 11:14 PM
So far I have my images (and the whole layout), cotrolled by an external style sheets. So the seems not to affect nay other part of the page layout. I just wondered if other browsers might not render the same way. But i'd better ask the question relative to that in the correct forum :)

thanks