Pemrograman Berbasis Web HTML – 2: Tag Pemrograman Berbasis Web
tag Cara html untuk memberi tanda elemen-elemennya sekaligus memberikan aturan bagaimana elemen-elemen html ditampilkan di browser
Kelengkapan sebuah tag Diawali: < diakhiri : > Berisikan Tag name Tag attribute Attribute value/nilai Harus ditutup agar memenuhi standar HTML yang baik. Note: kecuali tag khusus
break <br />
paragraf <p align=“left”> Halo ini isi dari paragraf 1. diisi apa ya? Wah nggak kepikiran mau diisi apa</p> Note= align is deprecated Align Left right center justify Deprecated. Use styles instead. Specifies the alignment of the text within a paragraph TF Deprecated A deprecated element or attribute is one that has been outdated. Deprecated elements may become obsolete in the future, but browsers should continue to support deprecated elements for backward compatibility. Obsolete Obsolete elements and attributes have no guarantee of browser-support and they are no longer defined in the W3C specification.
Kelengkapan sebuah tag FULL Version
Aturan penulisan tag Huruf kecil untuk tag name dan tag attribute TAG harus ditutup Attribute Value (nilai dari attribute) harus ditulis didalam quote, baik quote ganda (“) maupun quote tunggal (‘)
Tag wajib HTML Meta content type didalam header XML type <?xml version="1.0" encoding="UTF-8"?> Document tipe (mengidentifikasikan tipe html yang digunakan dan aturan-aturan html lainnya) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Tag html <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="id" lang="id"> Tag head dan tag body <head></head><body></body> Meta content type didalam header <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Template <?xml version="1.0" encoding="UTF-8"?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> </head> <body> </body> </html> Kalau error itu karena tidak ada titlenya
simple <html> <head> </head> <body> </body> </html>
Kelengkapan lain didalam head <title> <meta> description <meta name="description" content="Free Web tutorials" /> Keywords <meta name="keywords" content="HTML,CSS,XML,JavaScript" /> Author <meta name="author" content="Hege Refsnes" /> Link, dll
Full template HTML4.1 (Cuma ditambah title) <?xml version="1.0" encoding="UTF-8"?> <!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" xml:lang="en" lang="en"> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> </head> <body> </body> </html> Lainnya: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Mengecek standar file html http://validator.w3.org/
Aturan tag Lebih Detail a must not contain other a elements. pre must not contain the img, object, big, small, sub, or sup elements. button must not contain the input, select, textarea, label, button, form, fieldset, iframe or isindex elements. label must not contain other label elements. form must not contain other form elements.