Bahasa Penanda Hiperteks (HTML)/Pengenalan: Perbezaan antara semakan

Kandungan dihapus Kandungan ditambah
Algazel (bincang | sumb.)
Algazel (bincang | sumb.)
Baris 15:
Microsoft Internet Explorer merupakan pelayar yang paling banyak diguna (46% pasaran pada November 2010). Pelayar-pelayar lain termasuk Mozilla Firefox, Google Chrome, Safari, dan Opera. Untuk memastikan dokumen anda dapat dibaca dalan sekitaran teks sahaja, anda boleh menggunakan pelayar teks seperti Lynx.
 
===A simpleSebuah Dokumen Ringkas document===
Mari kita mula dengan sebuah dokumen ringkas. Tulis kod ini dalam penyunting anda (ataupun salin dan tampal) dan simpannya sebagai fail yang memiliki akhiran ".html" atau ".htm", misalnya sebagai "indeks.html" atau "indeks.htm". Fail perlu disimpan dengan akhiran sedemikian agar dapat dibuka dan dipaparkan dengan betul (langkah ini perlu buat platform Windows. Mac dan Linux tidak memerlukan penamaan fail atau demikian demikian cara).
Let's start with a simple document. Write this code in your editor (or copy-and-paste it) and save it as "index.html" or "index.htm". The file must be saved with the exact extension, or will not be rendered correctly.
 
<!--
Baris 28:
<html>
<head>
<title> SimpleDokumen documentringkas </title>
</head>
<body>
<p>TheTeks textdokumen ofdiletakkan thedi document goes heresini.</p>
</body>
</html>
</source>
 
Sekarang buka dokumen ataupun fail ini dengan pelayar anda dan lihat hasilnya. Daripada contoh di atas kita dapat simpulkan beberapa perkara pokok berkaitan dokumen HTML:
Now open the document in your browser and see the result. From the above example, we can deduce certain essentials of a HTML document:
* The first line of a valid HTML document must state which version of HTML the document uses. This example uses the strict variant of HTML version 4.01.
* The HTML document begins with a <code>&lt;html&gt;</code> tag and ends with its counterpart, the <code>&lt;/html&gt;</code> tag.
* Within the <code>&lt;html&gt;&lt;/html&gt;</code> tags, there are two main pairs of tags, <code>&lt;head&gt;&lt;/head&gt;</code> and <code>&lt;body&gt;&lt;/body&gt;</code>.
* Within the <code>&lt;head&gt;&lt;/head&gt;</code> tags, there are the <code>&lt;title&gt;&lt;/title&gt;</code> tags which enclose the textual title to be shown in the title bar of the web browser.
* Within the <code>&lt;body&gt;&lt;/body&gt;</code> is a paragraph marked by a <code>&lt;p&gt;&lt;/p&gt;</code> tag pair.
* Most tags must be written in pairs between which the effects of the tag will be applied.
** <nowiki><em>This text is emphasized</em></nowiki> &#8211; <em>This text is emphasized</em>
** <nowiki>This text includes <code>computer code</code></nowiki> &#8211; This text includes <code>computer code</code>
** <nowiki><em>This text is emphasized and has <code>computer code</code></em></nowiki> &#8211; <em>This text is emphasized and has <code>computer code</code></em><br>
* HTML tag pairs must be aligned to encapsulate other tag pairs, for example:
** <nowiki><code><em>This text is both code and emphasized</em></code></nowiki> &#8211; <code><em>This text is both code and emphasized</em></code><br>
** <strong>A mistake: </strong> &#8211; <nowiki><em><code>This mark up is erroneous</em></code></nowiki>
 
* Baris pertama sesuatu dokumen HTML yang ''sah'' ("valid") perlu memuatkan versi HTML yang diguna dokumen. Contoh ini mengguna sebuah variasi HTML, yakni HTML versi 4.01 yang ditulis seperti berikut:<br /> <code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"></code>
[[Category:HyperText Markup Language]]
* TheDokumen HTML documentbermula beginsdengan with atag <code>&lt;html&gt;</code> tagdan andberakhir endsdengan with its counterpartrakannya, thetag <code>&lt;/html&gt;</code> tag.
* WithinTerkandung thedalam tag-tag <code>&lt;html&gt;&lt;/html&gt;</code> tags, there are two main pairsterdapat ofsepasang tagstag, <code>&lt;head&gt;&lt;/head&gt;</code> anddan <code>&lt;body&gt;&lt;/body&gt;</code>.
* WithinTerkandung thedalam tag-tag <code>&lt;head&gt;&lt;/head&gt;</code> tags, therejuga areterdapat thetag-tag <code>&lt;title&gt;&lt;/title&gt;</code> tagsyang whichmerangkumi enclosejudul theteks textualyang titleakan todipaparkan be shown in the titlepada bar oftajuk thepelayar web browser.
* WithinTerkandung thetag-tag <code>&lt;body&gt;&lt;/body&gt;</code> isialah asatu paragraphperenggan markedyang byditanda adengan pasangan tag <code>&lt;p&gt;&lt;/p&gt;</code> tag pair.
* Kebanyakan tag perlu ditulis dengan pasangan masing-masing. Kesan tag ditulis antara tag-tag tersebut.
** <nowiki><em>ThisTeks textini isditekankan emphasized</em></nowiki> &#8211; <em>ThisTeks textini is emphasizedditekankan</em>
** <nowiki>ThisTeks textini includesmemuatkan <code>computerkod codekomputer</code></nowiki> &#8211; ThisTeks textini includesmemuatkan <code>computerkod codekomputer</code>
** <nowiki><em>ThisIni textmemuatkan isteks emphasizedyang andditekankan hasbeserta <code>computerkod codekomputer</code></em></nowiki> &#8211; <em>ThisIni textmemuatkan isteks emphasizedyang andditekankan hasbeserta <code>computerkod codekomputer</code></em><br>
* Pasangan tag HTML perlu diselaraskan agar merangkumi tag-tag lain, contoh:
** <nowiki><code><em>ThisTeks textini isadalah bothkod code anddan emphasizedditekankan</em></code></nowiki> &#8211; <code><em>ThisTeks textini isadalah both codekod anddan emphasizedditekankan</em></code><br>
** <strong>ASatu mistakekesilapan: </strong> &#8211; <nowiki><em><code>ThisPenanda markini upmengandungi is erroneousralat</em></code></nowiki>
 
[[Kategori:Bahasa Penanda Hiperteks|Pengenalan]]
 
[[ca:Llenguatge html/Introducció]]
[[en:Hypertext markup Language/Introduction]]]
[[es:Lenguaje HTML / Introducción]]
[[gl:HTML/Introdución]]