CSS adalah singkatan bagi Cascading Style Sheets. CSS bertujuan menentukan web style, bukan pada kandungan.
<!DOCTYPE html> <html> <head> <style> body { background-color: #d0e4fe; } /* This is a single-line comment */ h1 { color: orange; text-align: center; } p { font-family: "Times New Roman"; font-size: 20px; } </style> </head> <body> <h1>CSS Example</h1> <p>This is a paragraph.</p> </body> </html>
The element Selector.
<head> <style> h1 { color: orange; text-align: center; } </style> </head> <body> <h1>CSS Example</h1> </body>
The id Selector.
<head> <style> #center { text-align: center; } </style> </head> <body> <p id="center">This is 2nd paragraph.</p> </body>
The class Selector.
<head> <style> .red { color: red; } </style> </head> <body> <p class="red">This is 3rd paragraph.</p> </body>
Specific elements affected by a class.
<head> <style> p.green { color: green; } </style> </head> <body> <p class="green">This is 3rd paragraph.</p> </body>
Contoh: http://shahrulnizam.com/web/css_basic.php
Penerangan lanjut di