For some web-designer, correct HTML tag in every html file is a must. The HTML tag in every web page should follow the W3C, so it can be mentioned as a valid HTML page. But sometimes, although some image can be seen as good as we want, actually we (and other web-designer) did a very fatal mistake according to W3C standard. How come?

Image can be shown in every web page with a very simple HTML tag. For example, we want to display an image “example.jpg” from our hosting directory “www.compexplorer.com/images”. The HTML tag to show the image correctly is :

<img src=”http://www.compexplorer.com/images/example.jpg”>

With the HTML tag above, there’s no problem in any browser at all. The picture can be display correctly. But, unfortunately, it’s a wrong HTML tag according to W3C standard. How come?

W3C standarize the HTML tag for image with a minimum 2 attribute, consist of :

  • src : determine the target image to be displayed.
  • alt : determine the alternative text when the picture is not (yet) appear. If we do not want to display alternative text, we still have to inser this attribut with a blank (no text) inside.

Is it finish? Not yet. W3C also standarize a form for every HTML tag that do not have a closing tag, including image tag. It must be endded with a slash “/” before closed by a general closing tag “>”.

Then, we can make a correct HTML tag for image like this :

  • Without alternative text : <img src=”http://www.compexplorer.com/images/example.jpg” alt=”" />
  • With alternative text : <img src=”http://www.compexplorer.com/images/example.jpg” alt=”this is an example” />

Why should we follow the W3C guidance? Well, you can find the answer here. Enjoy!

Related posts:

  1. Tips for Faster Image Loading
  2. SEO for Image, Tips for your images
  3. Find Duplicate Image Using Image Comparer
  4. How To Create An HTML Newsletter
  5. Create a Favicon In Your Website
  6. An Ideal Solution to Upload Your PSD Files
  7. Hide Your Affiliate Link
  8. Introduction to Web Browsers
  9. What is Valid W3C Web?
  10. How To SEO A Website From Scratch – Free SEO Tutorial (Part 4)

3 Comments

Leave a Reply