Forum Moderators: open

Message Too Old, No Replies

W3C validator

having problems with <img ...>some text</img>

         

caspita

9:03 pm on May 13, 2004 (gmt 0)

10+ Year Member



Hi All,

I'm trying to validate my html pages but for the ones where I have some picture links with a comment the validator keeps giving me errors.

I have checked my code in detail and I don't see any problem (which I'm aware of at least).

Here an example:

validator says:

1. Line 11, column 262: end tag for element "IMG" which is not open

Line 11 in my code taken from the validator in self(edited for forum URL TOS) :

11: <div class="someclass"><a class="someotherclass" href="/sample/sample/sample.html" title="Some Title"><img src="/img/subimg/some-image.jpg" alt="Some Alt text"><br>Some additional info</img></a></div>

Doed anybody know what is not good here?

thanks,

Carlos.

sned

9:07 pm on May 13, 2004 (gmt 0)

10+ Year Member



Maybe you could try

<img src="/img/subimg/some-image.jpg" alt="Some Alt text" /><br />Some additional info

I've never used an <img>text</img> before, maybe somebody can tell me if it's useful :).

caspita

9:28 pm on May 13, 2004 (gmt 0)

10+ Year Member



Thanks sned!

it worked ;-)

well I don't know if </img> is usefull or not .. is just that I use to close every tag I open .. this case look like the closing is different :-)

Thanks again.

Carlos.

choster

9:34 pm on May 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which doctype are you using? <img>, like <br> or <hr>, is not a container element in HTML and does not allow a closing tag.

caspita

11:46 pm on May 13, 2004 (gmt 0)

10+ Year Member



Hi Choster,

This is what I am using:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

But you gave me the answer .. <img> is not a container ... that was my problem, I still have to check the references for every tag I use ;-), it was my mistake to try close all of them :-) .. I was even trying to close <meta> tag :-)

Now I'm happy .. all my pages looks to be validating fine.

Thanks!

Carlos