This is G o o g l e's cache of http://www.new2html.com/help/img-tag.shtml.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:QRIG4yTYe3gJ:www.new2html.com/help/img-tag.shtml+webtv+site:http://www.new2html.com&hl=en&ie=UTF-8


Google is not affiliated with the authors of this page nor responsible for its content.
These search terms have been highlighted: webtv 

New 2 HTML - Optimize Your WebTV
<p align="center"><font size="5" color="#ff0000"><b><B style="color:black;background-color:#ffff66">WebTV</B> JavaScript Bug Alert</b></font></p> <p align="center"><font size="5" color="#ff0000"><b>Reload Page</b></font></p> <p align="center"><font size="5" color="#ff0000"><b><u>CMD + R for 3 Seconds</u></b></font></p> <br /> <br /> <br /> <p align="center"><font face="verdana bold,arial bold,helvetica,sans-serif" color="#000000" size="4">Computer users, this site is designed by and for the <B style="color:black;background-color:#ffff66">WebTV</B>/MSNTV Internet Terminal and may not display or function as intended for you.</font></p> <font face="verdana bold,arial bold,helvetica,sans-serif" color="#000000" size="4"><br /> <img src="1x.gif" width="1" height="300" border="0" alt="spacer image" /></font>
Top Menu Image Map Sitemap Basic HTML Advanced HTML JavaScript WorkCenter TestBed Jump Box Menus Linkables Tips-n-Tricks What's New? Daily Tip


Proper use of <img> tag and it's attributes.



One of the first things a WebTV user learns when starting in HTML, is how to add an image or picture to their email or webpage. We know that the basic tag is:

<img src="http://ImageURL.jpg">

This will add the image to the page, but there are some attributes that should be added, both to improve the look, and the effectiveness of the image tag.


Height & Width Attributes

The most important attributes we can add to the image container are the height and width. These will not make the image load faster, but they do allow the page to load around the images, because the browser will know how much room to reserve for each image.

WebTV Logo For demonstration, we will use a WebTV Logo. The size of this image is 109x141 pixels, so the image container for it should include its measurements to speed page loading. The height and width attributes can come either before or after the URL, as long as they are within the container (image tag).

<img height="109" width="141" src="http://www.new2html.com/linkable/img/wtv.gif">

WebTV Logo

The image size can also be adjusted by simply changing the height and width attributes.

<img height="55" width="70" src="http://www.new2html.com/linkable/img/wtv.gif">


Border

An attribute that a lot of WebTV users don't use designates the border size. WebTV users can't see a border on most images, but computer users do. To make your pages look cleaner for computer visitors, you should add border="0". You can also add a larger border to an image if you would like to give it a framed look.
border="0"
WebTV Logo
border="5"
WebTV Logo
<img height="109" width="141" border="0" src="http://www.new2html.com/linkable/img/wtv.gif">


ALT Attribute

Another often overlooked image attribute is the ALT, or alternate text one.

Computer users have the option of turning off the images as they surf. If you don't use the alt attribute, all a computer user will see is an empty box where the image actually is. By adding alt text you can tell them what they are missing, and even give them a short message in a window that pops up next to the image when the user highlights it.

To see what this looks like to a computer user, visit these two screen shots of the same page, one with images on, one with images off. You will be able to see the text that I have added to the alt command in the small window.

Images On        Images Off

This is the tag used on that page.

<img height="321" width="260" border="0" src="scanner/bud-pp.jpg" alt="Click here to see a picture of my dog Bud. Don't worry, he won't bite...well, maybe a little.">

HTML validator sites strongly recommend the use of alt attributes. Search engines also read the alt information and use it to help rank your site. So be descriptive, to help yourself, as well as your visitors.

Another attribute that works much like the ALT attribute is the title attribute. It can be used to add a caption under an image. Here is a screen shot of what the title attribute looks like on some computer browsers.

<img height="109" width="141" border="0" src="http://www.new2html.com/linkable/img/wtv.gif"
title="WebTV Logo">


Image Alignment

We can use the align attribute to control where the image is displayed, and how the surrounding text reacts around it. Here are some basic examples of alignment.

WebTV LogoThis image is contains align="right". This alignment command will put the image on the right margin, allowing the text to flow around its left side. If you use align="left" you will get the opposite effect. As you continue with the page, the text will continue on, going straight across once it clears the image.

<img height="87" width="113" border="0" src="http://www.new2html.com/linkable/img/wtv.gif"
align="right">

WebTV LogoYou can also use align="bottom" to align continuing text along the baseline of the image.


Horizontal & Vertical Spacing

WTV logo on blackNext we discuss the hspace and vspace attributes. As you can see, when using an image with a contrasting background color, text runs right up to its edge, making reading difficult, as well as taking away from the over-all look of the page.

WTV logo on blackBy adding these two attributes, we can keep the text from crowding the image. Here we have added
hspace="25" and vspace="25" to give us a buffer of 25 pixels around the image on all sides for a way to keep pages looking best.

If you are familiar with using tables, the H & V space attributes are much like cellpadding.

<img height="87" width="113" border="0" src="http://www.new2html.com/linkable/img/wtv-2a.gif"
align="left" hspace="25" vspace="25">

There is 1 visitor online



Search New2HTML.com powered by FreeFind