Panduan Penggunaan CSS untuk Web
Panduan Penggunaan CSS untuk Web
ATURCARA OUTPUT
<html>
<head>
<title>Tanpa Penggunaan CSS </title>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
<html>
<head>
<title>Penggunaan CSS </title>
<style>
h1 { color:blue;}
</style>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
HELAIAN GAYA
HELAIAN GAYA LUAR GAYA DALAM BARISAN
DALAMAN
(External Style Sheet) (Inline Style)
(Internal Style Sheet)
• Tag gaya akan ditulis dan • Tag gaya boleh ditulis • Tag gaya akan ditulis pada
disimpan di dalam satu fail sama ada di dalam bahagian/elemen tag.
dan fail itu mesti kawasan <head> atau
mempunyai extension <body>.
“CSS”. • Letakkan <style>
• Fail tersebut akan
dipanggil daripada tag
HTML dengan
menggunakan sintaks.
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA
h1 { color: blue;}
<html>
<head>
<title>Penggunaan CSS </title>
<link rel = "stylesheet" type = text/css“ href= "[Link]">
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
OUTPUT
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
<html>
<head>
<title>Penggunaan CSS </title>
<style>
h1 { color:blue;}
</style>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
<html>
<head>
<title>Penggunaan CSS </title>
</head>
<body>
<style>
h1 { color:blue;}
</style>
<h1>Laman Web Sekolah</h1>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Penggunaan CSS </title>
</head>
<body>
<h1 style = "color:blue";> Laman Web Sekolah</h1>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
<html>
<head>
<title>Penggunaan CSS </title>
<style>
h1 { color:red;}
</style>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Keluarga Fon </title>
</head>
<body>
<h1 style="font-family:Arial Black;">Laman Web
Sekolah</h1>
<h
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Warna Latar Belakang </title>
</head>
<Style>
body
{ background-color : lightgreen;
}
</style>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Gaya Jadual </title>
</head>
<Style>
table
{ border : 1px solid; }
</style>
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
html>
<head>
<title>Gaya Jadual </title>
</head>
<Style>
table, th,td
{ border : 1px solid;}
</style>
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
html>
<head>
<title>Gaya Jadual </title>
</head>
<Style>
table {border-collapse: collapse;}
table, th,td
{ border : 1px solid;}
</style>
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
html>
<head>
<title>Gaya Jadual </title>
</head>
<Style>
table {border-collapse: collapse;}
table, th,td
{ border : 3px solid;}
</style>
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
html>
<head>
<title>Gaya Jadual </title>
</head>
<Style>
table {border-collapse: collapse;}
table, th, { border : 3px solid;}
td { border : 2px dashed;}
</style>
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
<body>
<h1>Laman Web Sekolah</h1>
<table>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
<body>
<h1>Laman Web Sekolah</h1>
<table cellpadding="20">
<tr>
<th> KANDUNGAN LAMAN WEB </th>
</tr>
<tr>
<td> Pengenalan Sekolah </td>
</tr>
<tr>
<td> Senarai Guru </td>
</tr>
</table>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Gaya Border </title>
<Style>
h1
{
border-style: solid;
border-width : 5px;
}
</style>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title>Gaya Border </title>
<Style>
h1
{
border-style: dashed;
border-width : 5px;
border-color : red;
}
</style>
</head>
<body>
<h1>Laman Web Sekolah</h1>
</body>
</html>
MENGGUNAKAN CSS UNTUK
3.3 3.3.4 MENGGAYAKAN
ATURCARA OUTPUT
<html>
<head>
<title>Tanpa Gaya Position </title>
</head>
<body>
<h1>Laman Web Sekolah (Absolute)</h1>
<h2>Sekolah 1 (Relative)</h2>
<h3>Sekolah 2 (Fixed)</h3>
<h4>Sekolah 3 (Static)</h4>
</body>
</html>
ATURCARA OUTPUT
<html>
<head>
<title> Gaya Position </title>
<style>
h1 { background-color : lightgreen; position :
absolute; width : 40%; top : 10px; left : 50px; height : 100px;
}
h2 { background-color : lightpink; position :
ralative; width : 30%; top : 70px; left : 3000px; height :
100px; }
h3 { background-color : lightblue; position :
fixed; width : 70%; bottom : 10px; left : 200px; height :
100px; }
h4 { background-color : lightgrey; position : static;
width : 10%; bottom : 70px; left : 200px; height : 100px; }
</style>
</head>
<body>
<h1>Laman Web Sekolah (Absolute)</h1>
<h2>Sekolah 1 (Relative)</h2>
<h3>Sekolah 2 (Fixed)</h3>
<h4>Sekolah 3 (Static)</h4>
</body>
</html>