Jump to content

A question


snowboard01

Recommended Posts

Hi this is a nooby question. Well I'm a nooby person. So here it is. What is the better tag to use to show an image on a webpage?object:

<object type="image/gif" data="http://mysite.myhost/myimage.gif" width="50px" height="50px"></object>

Or img

<img src="mysite.myhost/myimage.gif" />

Is one better supported? Should I use image because it is designed for images? should I use object because the w3c may eliminate the img tag in favor of object? I an very confused. Please help me.Thank you.

Link to comment
Share on other sites

Typically for multimedia I think, videos or Flash or something like that. Someone else might be able to give more examples.Also, a question for everyone, instead of doing this:<object ...></object>Is it still valid to do this:<object ... />I've always wondered that.. like if I have an empty textarea do I need an explicit closing tag.

Link to comment
Share on other sites

I guess I answered my own question. This validates:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>  <head><title>Test</title></head>  <body>    <div>Test test      <div />      <p />      <object />      <textarea rows="1" cols="1" />    </div>  </body></html>

Oddly enough though, this does not validate:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>  <head><title>Test</title></head>  <body>    Test test    <div />    <p />    <object />    <textarea rows="1" cols="1" />  </body></html>

You are not allowed to have plain text, a span, object, textarea, or things like that inside the root of the body. They need to be in a container like div, p, h1, etc. I didn't know that.

Error Line 9 column 12: document type does not allow element "object" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "address", "fieldset", "ins", "del" start-tag.
(mods: is it possible to get the html codeboxes to preserve indentation, or does the syntax coloring forbid that)
Link to comment
Share on other sites

(mods: is it possible to get the html codeboxes to preserve indentation, or does the syntax coloring forbid that)
I'll tell you before the mods you can't change that becease kaijim is the only one that can and he won't. Thats cool that you can self close any tag or make it 2 tag. For people reading this and saying whats the point of self closing a div? Ever coded rounded corners? This will save a fair bit of code thank you justsomeguy!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...