SlideShare a Scribd company logo
CASCADING STYLE SHEETS (CSS)
Pertemuan 2

CSS 1
intro to css, pengaturan color,
background, fonts
Digunakan untuk menambahkan style
(fonts, colors, spacing, dll) ke dalam
dokumen web
Syntax Dasar
selector { property: value; }
Misal:
body {background-color: #ffff00;}
• Metode Inline  menggunakan atribut style
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us">
<head>
<title>Selamat Datang</title>
</head>
<body style="background-color: #ffff00;">
<h1>Selamat Datang</h1>
</body>
</html>
• Metode Internal  menggunakan tag
<style></style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us">
<head>
<title>Selamat Datang</title>
<style>
body {background-color: #ffff00;}
</style>
</head>
<body>
<h1>Selamat Datang</h1>
</body>
</html>
• Metode Eksternal  menggunakan tag <link />
untuk menghubungkan dengan file cascading
style sheets (.css)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd">
<html lang="en-us">
<head>
<title>Selamat Datang</title>
<link rel="stylesheet" type="text/css"
href="style.css" />
</head>
<body>
<h1>Selamat Datang</h1>
</body>
</html>
color & background
•
•
•
•
•
•
•

color
background-color
background-image
background-repeat
background-attachment
background-position
background
color
• Untuk mendefinisikan warna foreground
h1 {
color: #ff0000;
}
background-color
• Untuk mendefinisikan warna latar belakang
body {
background-color: #ffff00;
}
h1 {
color: #ff0000;
background-color: #ffffff;
}
background-image
• Untuk mendefinisikan background image
body {
background-color: #ffff00;
background-image: url(“logo.gif”);
}
h1 {
color: #ff0000;
background-color: #ffffff;
}
background-repeat
• Digunakan untuk mengontrol perulangan dari
background
– repeat-x, repeat secara horisontal
– repeat-y, repeat secara vertikal
– repeat, repeat horisontal & vertikal
– no-repeat, tanpa perulangan
body {
background-color: #ffff00;
background-image: url(“logo.gif”);
background-repeat: no-repeat;
}
h1 {
color: #ff0000;
background-color: #ffffff;
}
background-attachment
• Digunakan untuk mengunci/tidak background
– scroll, image tidak dikunci
– fixed, image tetap/dikunci
body {
background-color: #ffff00;
background-image: url(“logo.gif”);
background-repeat: no-repeat;
background-attachment: fixed;
}
h1 {
color: #ff0000;
background-color: #ffffff;
}
background-position
• Untuk menempatkan background pada posisi
tertentu
• Value:
– left, center, right, top, bottom
– x y  x horisontal y vertikal, satuannya bisa %,
pixel, cm, dll
body {
background-color: #ffff00;
background-image: url(“logo.gif”);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: bottom right;
}
h1 {
color: #ff0000;
background-color: #ffffff;
}
background
• Digunakan untuk menggabung penulisan property
background
background-color: #ffff00;
background-image: url(“logo.gif”);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: bottom right;

background: #ffff00 url(“logo.gif”) no-repeat fixed bottom right;
Fonts
•
•
•
•
•
•

font-family
font-style
font-variant
font-weight
font-size
font
font-family
• Digunakan untuk menentukan jenis font yang
akan ditampilkan
• Kategori font:
– Family-name: nama dari font (Arial, Times New
Roman, Tahoma
– Generic family: group dari family-name (sans,
sans-serif, monospace)
h1 {
font-family: arial, verdana, sans-serif;
}
h2 {
font-family: “Times New Roman”, serif;
}
font-style
• Digunakan untuk menentukan style dari font
– normal
– italic
– oblique
h1 {
font-family: arial, verdana, sans-serif;
}
h2 {
font-family: “Times New Roman”, serif;
font-style: italic;
}
font-variant
• Digunakan untuk menentukan variant dari font
– normal
– small-caps
h1 {
font-variant: normal;
}
h2 {
font-variant: small-caps;
}
font-weight
• Digunakan untuk menentukan bobot dari font
–
–
–
–
–

normal
bold
bolder
lighter
100 – 900

p {
font-family: arial, verdana, sans-serif;
font-weight: bold;
}
font-size
• Digunakan untuk menentukan ukuran dari font
–
–
–
–
–
–
–
–
–
–
–

xx-small
x-small
small
medium
large
x-large
xx-large
smaller
larger
length
%
h1 {
font-size:
}
h2 {
font-size:
}
h3 {
font-size:
}
p {
font-size:
}

40px;

10pt;

150%;

1em;
font
• Digunakan untuk menggabung penulisan font
property
p {
font-style: italic;
font-weight: bold;
font-size: 10pt;
font-family: arial, sans-serif;
}
p {
font: italic bold 10pt arial, sans-serif;
}

More Related Content

PDF
The Great State of Design with CSS Grid Layout and Friends
PPT
Sistem Informasi Akuntansi
PDF
Rancangan Sistem Informasi Penjualan Tunai pada Metedologi Berorientasi obyek...
DOC
Analisa sistem penjualan tunai pada pt. aurora medika purwokerto
DOCX
Laporan Analisis SIA pada PT.EPSON Batam ( Proses Pembelian Kredit )
PDF
Chapter 3 css
PPTX
pertemuan 4-Cascading Style Sheet (CSS).pptx
The Great State of Design with CSS Grid Layout and Friends
Sistem Informasi Akuntansi
Rancangan Sistem Informasi Penjualan Tunai pada Metedologi Berorientasi obyek...
Analisa sistem penjualan tunai pada pt. aurora medika purwokerto
Laporan Analisis SIA pada PT.EPSON Batam ( Proses Pembelian Kredit )
Chapter 3 css
pertemuan 4-Cascading Style Sheet (CSS).pptx

Similar to Presentation 2 - Cascading style sheets (css) (20)

DOC
Pertemuan8
PDF
Praktikum CSS
PPTX
pengenalan dasar CSS untuk pemrograman web.pptx
PPTX
Pemograman WEB (CSS)
PPT
dasar-css1.ppt
PPT
bab-2a-dasar-css1.ppt
PDF
Css tutorial-01
PDF
Css tutorial-01
PDF
Css tutorial-01
PDF
Css tutorial-01
PDF
DOCX
Laporan pratikum II web
PPT
Materi8-CSS full-tutorial-recomend.ppt a
PDF
Css tutorial-12 2
PDF
Css tutorial-12
PPTX
Pengenalan web minggu ketiga
PPT
DOC
Laporan css 1210651099
PPT
18040 pertemuan13(css)
Pertemuan8
Praktikum CSS
pengenalan dasar CSS untuk pemrograman web.pptx
Pemograman WEB (CSS)
dasar-css1.ppt
bab-2a-dasar-css1.ppt
Css tutorial-01
Css tutorial-01
Css tutorial-01
Css tutorial-01
Laporan pratikum II web
Materi8-CSS full-tutorial-recomend.ppt a
Css tutorial-12 2
Css tutorial-12
Pengenalan web minggu ketiga
Laporan css 1210651099
18040 pertemuan13(css)
Ad

Recently uploaded (9)

PPT
pengantar-sistem-informasi manajemen.ppt
DOCX
Keutuhan Aplikasi Konsep dan Praktik dalam Upaya menciptakan aplikasi Anti Vi...
PPTX
Implementasi Microservices pada Manufaktur
PPTX
Peranan AI dalam Dunia Pendidikan dan Industri Aplikasinya
PDF
Rekomendasi Riset Lanjutan : perspektif_futurologis.pdf
PPTX
Materi_Array_Karakter_String untuk kelas XI sma.pptx
DOCX
Antivirus Versi.FULL.JALiN.KB.PRO Keutuhan Aplikasi Konsep dan Praktik dalam ...
PDF
Modul_Pemula_Merakit_Komputer untuk smppdf
PPTX
Materi asdsa asd asd sad sa dsa dsa d sa
pengantar-sistem-informasi manajemen.ppt
Keutuhan Aplikasi Konsep dan Praktik dalam Upaya menciptakan aplikasi Anti Vi...
Implementasi Microservices pada Manufaktur
Peranan AI dalam Dunia Pendidikan dan Industri Aplikasinya
Rekomendasi Riset Lanjutan : perspektif_futurologis.pdf
Materi_Array_Karakter_String untuk kelas XI sma.pptx
Antivirus Versi.FULL.JALiN.KB.PRO Keutuhan Aplikasi Konsep dan Praktik dalam ...
Modul_Pemula_Merakit_Komputer untuk smppdf
Materi asdsa asd asd sad sa dsa dsa d sa
Ad

Presentation 2 - Cascading style sheets (css)