Jump to content

Heading and drawing.


EvilBro

Recommended Posts

I've two questions:1. When writing an XHTML document, should you start with a <?xml ?>-tag?2. I want to have a circle drawn on screen that changes colour when clicked. I don't want to use two images. How do I achieve this? (should I use <canvas>? or SVG? or is there another option?)

Link to comment
Share on other sites

I've two questions:1. When writing an XHTML document, should you start with a <?xml ?>-tag?2. I want to have a circle drawn on screen that changes colour when clicked. I don't want to use two images. How do I achieve this? (should I use <canvas>? or SVG? or is there another option?)
XML tags are <? and ?> otherwise known as the "Short tags" for PHP. It's recommended that you start using the long-hand PHP tags in the first place anyway.
Link to comment
Share on other sites

yes <? ?> is used in php but it is also how you declare xml doctypes <?xml version="1.0"?>You do not have to start an XHTML doc with ?xml version="1.0"?> but it will work and validate correctly. using the <meta> to set the character encoding will also do the samething.

Link to comment
Share on other sites

XML tags are <? and ?> otherwise known as the "Short tags" for PHP.
That information seems to be conflicting with what I read in the w3c xhtml specification. They are referring to the tag as "the XML declaration". It doesn't have anything to do with php (as far as I can tell). In the specification they recommend using the declaration, but I've also been told that this confuses certain browsers, hence my question: should I use the tag?
Link to comment
Share on other sites

php is server side while XML/XHTML is processed on the client side so the 2 have nothing to do with each other. The php is processed and turned into HTML to send to the browser. It is more common to use <?php ?> for PHP.Don't worry about that comment it has nothing to do with your question.

Link to comment
Share on other sites

for now you should not put ANYTHING before a doctype (no whitespace, no blank line, no comment, no xml tag, nothing), because doing so will activate internet explorer's quirk mode of rendering, giving you unpredictable layout results across browsers.

Link to comment
Share on other sites

Guest FirefoxRocks

1. If you are sending application/xhtml+xml to certain browsers, use the <?xml version="1.0"?> thing. If you aren't (or don't know what content negotiation is), then do not use it. It triggers Quirks Mode for Internet Explorer 6 and that is seriously messy for web pages.2. I think SVG would be the best option here.

Link to comment
Share on other sites

2. I think SVG would be the best option here.
I'm giving it a try right now and have installed both Adobe as well as Renesis for IE (as it doesn't support SVG natively (yet?)). Unfortunately in IE the background of SVG isn't transparent by default. Anyone have any idea how to fix this?
Link to comment
Share on other sites

Placing the xml declaration ahead of the doctype puts IE6 into quirks mode. Even though the w3c specifies to put it there, it is not a good idea, and the code will still validate.

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...