XHTML facts for kids
Filename extension |
.xhtml, .xht,
.xml, .html, .htm |
---|---|
Internet media type |
application/xhtml+xml
|
Developed by | World Wide Web Consortium |
Initial release | 26 January 2000 |
Latest release |
5.0
28 October 2014 |
Type of format | Markup language |
Extended from | XML, HTML |
Standard | W3C HTML5 (Recommendation) |
Free format? | Yes |
XHTML stands for eXtensible HyperText Markup Language. It is a special way to write code for websites and webpages. Think of it as a set of rules for how to build web pages.
XHTML is a lot stricter than regular HTML. It's based on both XML (a language for storing data) and HTML. Because HTML can be a bit messy, different web browsers sometimes show websites differently. XHTML's strict rules help make sure that a web page looks exactly the same, no matter which browser you use. It also makes the code easier for people to read and understand.
Why is XHTML Strict?
XHTML has very clear rules that you must follow when writing code. This is different from HTML, which is more forgiving. If you don't follow the rules in XHTML, the web page might not work correctly.
For example, here's a small difference between HTML and XHTML:
Incorrect, HTML version:
<br>
Correct, XHTML version:
<br />
In HTML, the `
` tag creates a line break and doesn't need a closing tag. But in XHTML, every tag must be closed. If a tag doesn't have a separate closing tag (like `
`), it must close itself within the same tag, like `
`. These are called "empty tags." Another empty tag is `
`, which draws a horizontal line across the page.
How XHTML Works with JavaScript
When using XHTML, there are a few things to remember about JavaScript. For example, using `innerHTML` in JavaScript with XHTML is not usually recommended. Also, the `document.write` command in JavaScript should generally be avoided when you are using XHTML. These are small technical details that web developers learn when they work with XHTML.
Related Pages
See also
In Spanish: XHTML para niños