Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

What makes XHTML XHTML?

I've recently gone into an old site that I built a year ago using Microsoft Expression Web which writes in XHTML. Now that I know CSS and HTML much better thanks to Treehouse I've been going in and rearranging the code and sprucing up the site. But I can't really see what's different between what I've been taught as HTML (HTML 4 with Treehouse) and the XHTML that the old program wrote.

Other than this line which starts at the top of each page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

I can't see what on earth is different. Can somebody explain?

Thanks, Demian

1 Answer

There isn't a difference really XHTML is flavor of HTML that is also valid XML which is a more generic markup language that has stricter syntax.

For a more detailed & technical explaination, a quote from the wikipedia page

While HTML (prior to HTML5) was defined as an application of Standard Generalized Markup Language (SGML), a very flexible markup language framework, XHTML is an application of XML, a more restrictive subset of SGML. Because XHTML documents need to be well-formed, they can be parsed using standard XML parsers—unlike HTML, which requires a lenient HTML-specific parser.

You can also check out this: http://www.dummies.com/how-to/content/the-relationship-between-html5-and-xhtml.html

Excellent answer.

Thanks, James. Interesting answer. I haven't checked the link yet but will. Still your brief explanation gives me some insight into a question that had me a little bit mystified. :)