By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,265 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,265 IT Pros & Developers. It's quick & easy.

New requirement for img tags? ( like <img src=... /> )

P: n/a
I have switched to a new HTML editor that comes with the Eclipse IDE
(plugin MyEclipse).

This editor flags image tags such as

<img src="http://xyz.com/images/logo.gif" alt="test" >

saying that the "element type "img" must be terminated by a matching
end-tag.
If I change the above img tag to

<img src="http://xyz.com/images/logo.gif" alt="test" />

i.e., I close the tag with a forward slash and angle right bracket,
than there are no more complaints.

Is this a new rule in HTML, that tags need to be treated more like
common XML and closed "properly" with "/>".

Thanks for your help and advice,

Wolfgang,
Santa Barbara, CA

Jun 11 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
mo******@alexandria.ucsb.edu wrote:
I have switched to a new HTML editor that comes with the Eclipse IDE
(plugin MyEclipse).

This editor flags image tags such as

<img src="http://xyz.com/images/logo.gif" alt="test" >

saying that the "element type "img" must be terminated by a matching
end-tag.
If I change the above img tag to

<img src="http://xyz.com/images/logo.gif" alt="test" />

i.e., I close the tag with a forward slash and angle right bracket,
than there are no more complaints.

Is this a new rule in HTML, that tags need to be treated more like
common XML and closed "properly" with "/>".


Not in HTML. Your editor seems to be expecting XHTML, in which all
elements do have to be closed. Check whether it can be configured for
plain HTML.
Jun 12 '06 #2

P: n/a
Dan

Harlan Messinger wrote:
Not in HTML. Your editor seems to be expecting XHTML, in which all
elements do have to be closed. Check whether it can be configured for
plain HTML.


Which syntax to use would depend on which doctype is used in the page,
which we can't tell because no URL was given.

--
Dan

Jun 12 '06 #3

P: n/a
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

Harlan Messinger wrote:
mo******@alexandria.ucsb.edu wrote:
I have switched to a new HTML editor that comes with the Eclipse IDE
(plugin MyEclipse).

This editor flags image tags such as

<img src="http://xyz.com/images/logo.gif" alt="test" >

saying that the "element type "img" must be terminated by a matching
end-tag.
If I change the above img tag to

<img src="http://xyz.com/images/logo.gif" alt="test" />

i.e., I close the tag with a forward slash and angle right bracket,
than there are no more complaints.

Is this a new rule in HTML, that tags need to be treated more like
common XML and closed "properly" with "/>".


Not in HTML. Your editor seems to be expecting XHTML, in which all
elements do have to be closed. Check whether it can be configured for
plain HTML.


Jun 13 '06 #4

P: n/a

mo******@alexandria.ucsb.edu wrote:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


That's not a doctype (search this ng - we beat this issue to death
regularly) but it does strongly suggest you're trying to write XHTML,
rather than HTML.

If you're writing XHTML, then yes, <img /> now needs to be closed
because you're working with XML, not SGML or HTML.. You should know
this. If you don't know this, and you don't desperately _need_ this,
then don't write XHTML, stick with HTML (which is no more XML now than
it has ever been).

XHTML may have its uses (opinions vary), but it certainly shouldn't be
used blindly. There are lots of problems with its correct, practical
use.

Jun 13 '06 #5

P: n/a
mo******@alexandria.ucsb.edu wrote:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


HTML (other than XHTML) has no such thing as an xmlns attribute or an
xml:lang attribute.
Jun 13 '06 #6

P: n/a
To see all the gory detail, you can have a look at another example
that causes the same effect of "missing img tag",
http://online.wellsfargo.com/

This redirects to another page whose page source causes the complaint.

Dan wrote:
Harlan Messinger wrote:
Not in HTML. Your editor seems to be expecting XHTML, in which all
elements do have to be closed. Check whether it can be configured for
plain HTML.


Which syntax to use would depend on which doctype is used in the page,
which we can't tell because no URL was given.

--
Dan


Jun 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.