Page 1 of 1

Question

Posted: Wed Jan 19, 2005 9:55 am
by Josh
Okay, I've been looking at a lot of code our site coders have been making and I'm very curious if I've always done my HTML wrong.

Code: Select all

<img src="http://www.site.com/my_image.jpg" alt="My Image" title="My Image">
This is what I would use if I were putting an image on my site yet on our site coder's coding they don't use the normal > to close a tag -- they use />

Example:

Code: Select all

<img src="http://www.site.com/my_image.jpg" alt="My Image" title="My Image" />
Is this proper to do?

Thanks in advance
~Josh /sp_ike.gif' class='bbc_emoticon' alt='(spike)' />

Question

Posted: Wed Jan 19, 2005 10:18 am
by ner0
yours would be valid html, the reason for the " />" is that the code is xhtml...

the img tag is an "empty" tag, meaning it has no need for a , and in order to ensure validity in xhtml you'll need to close the tag, hence the " />"

it's also the same with the html
, in xhtml this would be
(empty tag)

hope it helps

Question

Posted: Wed Jan 19, 2005 10:22 am
by Josh
Thanks ner0 /smile.gif' class='bbc_emoticon' alt=':)' />