Sintaks:
<html>
</html>
Tag HTML memuat 2 sesi jaitu <head> dan <body>, tetapi tidak termasuk tag <!DOCTYPE>.
Contoh:
Berikut ini adalah contoh penggunaan tag html dalam dokumen <html> HTML 5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, dan XHTML 1.1.
Dokumen HTML 5:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Contoh HTML 5</title>
</head>
<body>
<h1>Judul</h1>
<p>Isi Artikel</p>
</body>
</html>
Dokumen HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Contoh HTML 4.01 Transitional</title>
</head>
<body>
<h1>Judul</h1>
<p>Isi Artikel</p>
</body>
</html>
Dokumen XHTML 1.0 Transitional
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Contoh XHTML 1.0 Transitional</title>
</head>
<body>
<h1>Judul</h1>
<p>Isi Artikel</p>
</body>
</html>
Dokumen XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Contoh XHTML 1.0 Strict</title>
</head>
<body>
<h1>Judul</h1>
<p>Isi Artikel</p>
</body>
</html>
Dokumen XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Contoh XHTML 1.1</title>
</head>
<body>
<h1>Judul</h1>
<p>Isi Artikel</p>
</body>
</html>
Tag <html> secara mendasar didukung oleh browser:
- Android
- Chrome
- Firefox (Gecko)
- Firefox Mobile (Gecko)
- Internet Explorer (IE)
- IE Phone
- Opera
- Opera Mobile
- Safari (WebKit)
- Safari Mobile
Click here if you like this article.
0 Comments