Tag code - html code tag

Tag "code" atau html "code" tag adalah sebuah tag html yang berfungsi mendefinisikan kode komputer. Kode yang ingin ditampilkan di halaman blog/web diletakkan di antara tag pembuka (<code>) dan tag penutup (</code>). Pada tag "code" dapat ditambahkan beberapa attribute html seperti : class, id, style, dir, lang, title, accesskey dan beberapa tag lain.
Penggunaan attribute style memungkinkan berbagai perubahan style pada tag "code". Beberapa kode css seperti background-color atau background-image memungkinkan anda memberi warna latar atau image latar. Properti css seperti color, font-size, font-style, font-family, display property (block atau inline-block), text-decoration property serta beberapa css roperty lainnya dapat juga ditambahkan (Specifies an inline CSS style for an element).
Jika menghendaki tag "code" yang lebih simple, namun ingin melibatkan beberapa css property guna mendapatkan style tertentu pada tag "code" (custom style), anda dapat memanfaatkan kode css dan sebuah id atau class.

Contoh:

html "code" tag - sederhana
<code>code</code>
html code tag dengan attribute style
<code style="background-color: #000;color: #eee; font-family: Courier New; font-style: italic;">code</code>
Menambah attribute class pada tag "code"
<style type="tex/css">
code.mycode {
    background-color: #000;
    color: #eee; 
    font-family: Courier New, Courier, Monospace; 
    font-style: italic;
}
</style>

<code class="mycode">code</code>
Edit kode dalam box demo di bawah ini untuk mengetahui lebih jelas fungsi tag "code". Anda juga dapat menggabungkan tag "code" dengan tag lain, bahkan jika diperlukan bisa juga ditambahkan attribute style dengan beberapa properti css misalnya color, background dan properti lain.
Please click the button to display. Continue with editing code and click to see the results!

Tidak ada komentar:

Posting Komentar

My ProfileC l o s e

FollowerC l o s e