HTML (HyperText Markup Language) and x HTML (eXtensible HyperText Markup Language) are both HTML HyperText markup languages used to create web pages. While they share many similarities they have key difference in term of syntax, compliance with standards and flexibility.
HTML Example
<!DOCTYPE html> <html lang="en"> <head> <title>HTML with Example</title> </head> <body> <h1>Welcome to HTML</h1> <p>simple HTML page.</p> <!-- No need to close img tag properly --> <img src="image.jpg" alt="Sample Image"> </body> </html>
XHTML Example:
<!DOCTYPE html> <html lang="en"> <head> <title>XHTML Example</title> </head> <body> <h1>Welcome to XHTML</h1> <p>Simple XHTML page.</p> <!-- All tags must be properly closed --> <img src="image.jpg" alt="Sample Image" /> </body> </html>