CSS. CSS adalah standar pembuatan dan pemakaian style (font, warna, jarak baris, dll) untuk dokumen terstruktur

dokumen-dokumen yang mirip
CSS. Auriza Akbar 1 Juni 2012

PROPERTIES. Pemrograman Web Teknik Informatika Fakultas Teknologi Industri

CSS Cascading Style Sheet

Cascading Style Sheets (CSS)

Cascading Style Sheet (CSS) pada HTML

DAFTAR ISI Bab 1 Mengenal Teknologi Internet dan Web... 1 Bab 2 Tentang CSS... 9

Komponen CSS Nilai Properti

CSS (CASCADING STYLE SHEET)

Cascading Style Sheets (CSS)

/* styling paragraf, teks paragraf berwarna biru dan rata tengah */ p {color:blue;text-align:center;}

DASAR-DASAR CSS DASAR-DASAR CSS By: Rohi Abdulloh A. PENGENALAN

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS)

MATERI II CASCADING STYLE SHEETS (CSS) DASAR

XHTML dan Dasar-dasar CSS XHTML

MODUL PRAKTIKUM PEMROGRAMAN WEB (DASAR)

Introduksi. Team Training SMK-TI I-58

CSS RANDY CAHYA WIHANDIKA, S.ST., M.KOM

Pemrograman Web PRAKTIKUM 3 CSS. TUJUAN BELAJAR Mahasiswa dapat menggunakan css untuk mengatur gaya tampilan elemenhtml

Mendesain halaman Web

Multiple Style akan meng-cascade kedalam Style Lain

{CSS} Cascading Style Sheet

APLIKASI WEB DAY 3. (Cascading Style Sheets)

CSS. inheritance (pewarisan)

TAKEN FROM ROSIHANARI.NET

Cara Value keterangan

CSS dan Tata Letak Pemrograman Internet (TKE ) Program Studi Teknik Elektro, Unsoed

Artikel HTML Dasar. World Wide Web ( WWW ) yang biasa disebut web merupakan suatu kumpulan

MODUL III CASCADING STYLE SHEET

MODUL 1 STYLE SHEET UNTUK TAMPILAN DASAR

CSS. Cascading Style Sheet. Spesifikasi lengkap di :

MODUL PRATIKUM 04A PEMROGRAMAN BERBASIS WEB (CCP119)

Cascading Style Sheet (CSS) Didik Dwi Prasetya

Teks dan Background SERIF SANS-SERIF MONOSPACE

DAFTAR ISI DAFTAR ISI... 1 KATA PENGATAR... 2 BAB I PENDAHULUAN Latar Belakang Rumusan Masalah Tujuannya...

Introduksi. Team Training SMK-TI I-58

Mata Kuliah Pemrograman Web S1 SI Semester 2 Materi Kuliah Cascading Style Sheet CSS STMIK AMIKOM Yogyakarta

Penggunaan CSS dalam Perancangan Web

Author : Minarni, S.Kom.,MM

BAB III CASCADING STYLE SHEET

6. HTML & CSS. PTI15010 Pemrograman Web. Agi Putra Kharisma, S.T., M.T. Genap 2014/2015. Desain slide ini dadaptasi dari University of San Fransisco

STMIK AMIKOM YOGYAKARTA YOGYAKARTA 2008 WIDHIARTA, S. KOM

Keuntungan Memisahkan presentation sebuah dokumen dari content document itu sendiri Mempermudah dan mempersingkat pembuatan dan pemeliharaan dokumen w

MODUL PEMOGRAMAN WEB I STMIK IM BANDUNG MODUL PEMOGRAMAN WEB I. Oleh: CHALIFA CHAZAR. Chalifa Chazar edu.script.id

CSS (Cascading Style Sheet)

BAB IV CASCADING STYLE SHEET (CSS)

: PRAKTIKUM CSS 3 [Color dan Background] NAMA : KELAS : TANGGAL PRAKTIKUM :

CSS Layouting. Antonius RC Pemrograman Web

Perancangan Web. Perancangan Web. Oleh : Moh. Sulhan. By : MOH.SULHAN

Daftar isi. West PoinT edu

Contoh Syntax: Contoh di atas menunjukkan. S e l e c t o r : h 1. P r o p e r t y : c o l o r. V a l u e : r e d. (red).

Triswansyah Yuliano

Pemrograman berbasis Web dan Multimedia. Web and Multimedia based Programming K2133

A. LATAR BELAKANG ATAU BACKGROUND

CSS Cascading Style Sheet

MODUL III CASCADING STYLE SHEET

CSS background mengizinkan kita untuk mengatur warna, setting image, repeat image secara horizontal dan vertical.

Sanksi Pelanggaran Pasal 72 Undang-undang Nomor 19 Tahun 2002 Tentang Hak Cipta 1. Barangsiapa dengan sengaja melanggar dan tanpa hak melakukan

MODUL 3 STYLE SHEET RINGKASAN

Diktat CSS. Cascading Style Sheet. L. Erawan

MACROMEDIA DREAMWEAVER 8

TUGAS UTS WEB STATIS. : Apriyanto Wibowo NIM : : Teknik Informatika S1 (Malam) Pengertian framework

TUTORIAL WEBDESIGN HTML & CSS DENGAN DREAMWEAVER

Secara garis besar, terdapat 3 cara menginput kode CSS, yaitu metode Inline Style, Internal Style Sheets, dan External Style Sheets.

CARA CEPAT DAN MUDAH UNTUK MENGUASAI. CSS Rule.

MODUL PRATIKUM 04B PEMROGRAMAN BERBASIS WEB (CCP119)

CSS (Cascade Style Sheet)

MATERI II CASCADING STYLE SHEETS (CSS)

Percobaan 1 : Mengatur Width Dan Height Hasil :

Pemrograman Web. Cascading Style Sheets. Created by : Rifqi Sambas Khairurrohman

Cara Membuat website dengan Dreamweaver

Cascading Style Sheets (CSS)

MODUL PEMOGRAMAN WEB I STMIK IM BANDUNG MODUL PEMOGRAMAN WEB I. Oleh: CHALIFA CHAZAR. Chalifa Chazar edu.script.id

TRAINING. Basic HTML & CSS. Jan-2013 USER BAGIAN 3

Nilainya berupa nama font yang diinginkan dan. Memasukkan nilai dari beberapa font sekaligus dengan pemisah tanda koma (,):

Modul 10 DreamWeaver MX Suendri, S.Kom

MODUL PRATIKUM 03B PEMROGRAMAN BERBASIS WEB (CCP119)

Membuat Form Kontak yang Indah dan Atraktif dengan AJAX [Part 2]

Metode Penulisan Dasar CSS

2011 Ahmad Amarullah

CSS Cascading Style Sheet

HTML dan CSS. Mark Up Language

BAB V DESAIN WEB CSS

BAB 6 CSS 6.1. CSS SYNTAX. Syntax CSS memiliki dua bagian utama yaitu, selector dan deklasi.

CSS (Cascading Style Sheets)

TUTORIAL CSS. CSS merupakan kepanjangan dari Cascading Style Sheet yaitu suatu dokumen yang digunakan untuk melakukan pengaturan halaman web.

LAPORAN RESMI PRAKTIKUM TEKNOLOGI WEB PENGENALAN CSS OLEH : LISTHYA KUMALASARI

TUGAS BOXES. 1. Percobaan 1

Eko Purwanto WEBMEDIA Training Center Medan

A. LATAR BELAKANG ATAU BACKGROUND

Cascading Style Sheet. Antonius RC CSS Styling - Progweb

NAMA : KELAS : TANGGAL PRAKTIKUM : A. TUJUAN 1. Siswa dapat mengenal, memahami serta dapat melakukan pengaturan-pengaturan border dengan CSS.

CSS Adalah : Mekanisme sederhana untuk mengubah jenis huruf, warna, ukuran dan lain-lain pada halaman website

PEMROGRAMAN WEB 1 CSS


PRAKTIKUM 3 Pengenalan CSS

MEMBUAT WEBSITE SEDERHANA DENGAN HTML 5

(Standard Generalized Markup Language)

Modul 3 CSS CASCADE STYLE SHEET

Materi. I. Pengenalan HTML II. Basic Tag HTML III. Table IV. Image

Transkripsi:

Dasar CSS

CSS CSS = Cascading Style Sheets CSS adalah standar pembuatan dan pemakaian style (font, warna, jarak baris, dll) untuk dokumen terstruktur CSS memisahkan presentation sebuah dokumen dari content dokumen itu sendiri Spesifikasi CSS1, http://www.w3.org/tr/rec-css1 CSS2, http://www.w3.org/tr/rec-css2

Keuntungan Pemisahan Desain dengan Content Kode HTML lebih bersih Meningkatkan rangking mesin pencari (Search Engine Ranking) Memudahkan pemeliharaan Download lebih cepat Satu file style sheet kemudian masuk ke cache Jika menggunakan tabel, dibutuhkan image spacer selain itu semua bagian tabel harus didownload dulu sebelum contentnya

Rule Syntax Style sheet didefinisikan dalam bentuk rule, terdiri dari: Selector Declaration : property & value Contoh rule : h1 { color: blue } Keterangan: Selector : h1 Property : color Value : blue Seluruh elemen (tag) HTML dapat digunakan sebagai selector CSS comment : /*.komentar. */

Kategori Style Sheet 1. Inline Style Sheet (di dalam elemen HTML) <p style="color: green"> 1. Embedded Style Sheet /internal style sheet (di dalam dokumen HTML) <style type="text/css"> h1 {color: blue} </style> 1. Linked Style Sheet / eksternal style sheet (di file eksternal) <link rel="stylesheet" type="text/css" href="http://webku.com/cool.css"> <style type="text/css"> @import url(http://webku.com/cool.css); </style> Isi file eksternal sama dengan kode di antara tag <style> </style> 1. Default Style Sheet (style default dari browser / user agent)

Urutan Cascade Makin ke bawah, makin didahulukan Default style sheet dari user agent / browser Eksternal Style Sheet Internal Style Sheet Inline Style Sheet Pengecualian : Pendeklarasian external CSS dalam tag <head> terletak di bawah internal CSS maka yang dipakai adalah eksternal CSS karena letaknya lebih bawah

Grouping Grouping (pengelompokan) : Selector : h1, h2, h3 { font-family: arial } Declaration : h1 { font-weight: bold; font-size: 14pt } Value : h1 { font: bold 12pt arial } Apabila diinginkan untuk mengatur lebih dari 1 property maka antar property : value bisa dibatasi menggunakan tanda titik koma ( ; ) Apabila ingin melakukan pengaturan untuk group, tiap selector dipisahkan dengan tanda koma

Inheritance Inheritance (pewarisan) : Bila style tidak didefinisikan, maka akan digunakan definisi style dari induknya <html> <head> <style type="text/css"> body {color: navy} h1 {font-family: Arial} b {text-decoration: underline} </style> </head> <body> <h1>ini <b>homepage</b> Saya</h1> Ini adalah homepage yang menggunakan CSS. </body> </html>

Macam-macam Selector Tag (elemen) HTML h1 {color: green} i {font-style: normal} Class.mhs {border: black solid 1; color: gray}.nama {font: bold 20 Arial} ID #mhs02 {color: red} Kontekstual h1 i {color: navy} div.mhs.alamat b {color: green} <h1>daftar Mahasiswa <i>student Exchange</i></h1> <div id="mhs01" class="mhs"> <span class="nama">adrian Marzuki</span><br> <span class="alamat">jl. Tubagus Ismail XI/5 <b>bandung</b></span> </div> <div id="mhs02" class="mhs"> <span class="nama">dewi Purnama</span><br> <span class="alamat">jl. Cisitu Lama 24 <b>bandung</b></span> </div> <i>last updated 10 September 2003</i>

Specificity Selector yang lebih spesifik akan dipakai, daripada yang lebih general Cara menentukan nilai specificity : Hitung jumlah atribut ID (a) Hitung jumlah atribut CLASS (b) Hitung jumlah nama tag (c) Deretkan angka a b c sehingga membentuk sebuah angka Angka yang lebih besar berarti lebih spesifik Contoh : li {...} /* a=0 b=0 c=1 -> specificity = 1 */ ul li {...} /* a=0 b=0 c=2 -> specificity = 2 */ ul ol li {...} /* a=0 b=0 c=3 -> specificity = 3 */ li.mhs {...} /* a=0 b=1 c=1 -> specificity = 11 */ ul ol li.mhs {...} /* a=0 b=1 c=3 -> specificity = 13 */ #mhs01 {...} /* a=1 b=0 c=0 -> specificity = 100 */

Pseudo Class Pseudo class dapat digunakan sebagai selector meskipun class-nya tidak terdapat di kode HTML Untuk menyatakan style yang digunakan jika suatu kondisi eksternal dikenakan pada elemen HTML (misalnya di-klik mouse) Sintaks pseudo class : selector:pseudo-class {property: value} Anchor (<a>) pseudo class : :link :visited :hover :active :focus Contoh : a:link { color: red } a:visited { color: green } a:hover { color: blue } a:active { color: purple } a:focus { color: yellow } a.mhs:link { color: maroon }

Pseudo Element Untuk menyatakan style yang digunakan terhadap suatu kondisi tipografi, bukan struktur (misalnya baris pertama) Pseudo element : :first-letter :first-line Contoh : p:first-letter { font-size: 200%; float: left} p:first-line { color: green } h1.mhs:first-letter { font-size: 20pt } <html> <head> <title>drop cap initial letter</title> <style type="text/css"> p:first-letter { font-size: 200%; font-weight: bold; float: left } span { text-transform: uppercase } </style> </head> <body> <p><span>the first</span> few words of an article in The Economist.</p> </body> </html>

Warna yang dipakai di CSS Predefined names: white black red 8-bit hexadecimal intensities for red, green, blue: #ff0000 R G B 0-255 decimal intensities: rgb(255,255,0) R G B Percentage intensities: rgb(80%,80%,100%) R G B

Ukuran yang dipakai di CSS 2px pixels 1mm millimeters 2cm centimeters 0.2in inches 3pt printer s points 2em, 4ex other printer s units

CSS Properties Font Color & Background Text List Box Model Visual Formatting Model (normal & float) User Interface & Downloadable Font Media Types Visual Effects Positioning Scheme

Font font-family: <fontname> p {font-family: Arial, Verdana, "Times New Roman"} font-style: normal italic p {font-style: italic} font-variant: normal small-caps p {font-variant: small-caps} font-weight: normal bold bolder lighter 100 900 p {font-weight: bold} p {font-weight: 400} font-size: xx-small x-small small medium large x-large xx-large font-size: larger smaller font-size: <length> <percentage> p {font-size: large} p {font-size: smaller} p {font-size: 200px} p {font-size: 150%} font: [<style> <variant> <weight>]? <size>[/<line-height>]? <family> font: caption icon menu message-box small-caption status-bar p {font: italic 12pt "Helvetica Nue", serif} p {font: bold italic large Palatino, serif} p {font: normal small-caps bold 120%/120% fantasy} p {font: x-large/20pt "new century schoolbook", serif} p {font: menu}

color: <color> p {color: red} p {color: #448F2C} p {color: rgb(255,0,0)} p {color: rgb(100%,50%,25%)} p {color: #f25} background-color: <color> transparent body {background-color: transparent} Color & Background background-image: <url> none body {background-image: none} body {background-image: url(http://www.site.com/logo.gif)} background-repeat: repeat repeat-x repeat-y no-repeat body {background-repeat: no-repeat} background-attachment: scroll fixed body {background-attachment: fixed} background-position: [<percentage> <length>]{1,2} background-position: [ top center bottom] [ left center right] body {background-position: 50%} body {background-position: 200px 50%} body {background-position: center} body {background-position: right bottom} background: [ <color> <image> <repeat> <attachment> <position> ] body {background: url("chess.png") gray 50% repeat fixed }

Text text-indent: <length> <percentage> p {text-indent: 5em} text-align: left right center justify p {text-align: justify} text-decoration: none [ underline overline line-through blink ] p {text-decoration: underline overline} text-shadow: none [ <color> <length> <length> <length>? ] h1 {text-shadow: 3px 3px 5px red} text-transform: capitalize uppercase lowercase none h1 {text-transform: capitalize} letter-spacing: none <length> p {letter-spacing: 3px} p {letter-spacing: -1px} word-spacing: none <length> p {word-spacing: 2em} line-height: normal <number> <length> <percentage> p {line-height: 1.5} white-space: normal pre nowrap p {white-space: pre}

List list-style-type: disc circle square decimal decimal-leading-zero lower-roman upper-roman lower-alpha lower-latin upper-alpha upper-latin none ul {list-style-type: circle} list-style-image: <url> none ul {list-style-image: url(smiley.gif)} list-style-position: inside outside ul {list-style-position: inside} list-style: <style> <position> <image> outside ol {list-style: lower-alpha outside url(smiley.gif)} inside

Box Model (1) margin-[top right bottom left]: <length> <percentage> auto div {margin-top: 10px} div {margin-right: 20%} div {margin-bottom: -5px} div {margin-left: 20pt} margin: [ <length> <percentage> auto ]{1,4} div {margin: 3em} div {margin: 1em 2em} div {margin: 5em 2em 3em} div {margin: 8em 4em 15em 10em} padding-[top right bottom left]: <length> <percentage> auto div {padding-top: 10px} div {padding-right: 20%} div {padding-bottom: -5px} div {padding-left: 20pt} padding: [ <length> <percentage> auto ]{1,4} div {padding: 8em 4em 15em 10em} border-[top right bottom left]-width: thin medium thick <length> div {border-top-width: thin} div {border-right-width: 6px} div {border-bottom-width: 2em} div {border-left-width: 10} border-width: <width>{1,4} div {border-width: thin medium 10 20}

Box Model (2)

Box Model (3) border-[top right bottom left]-color: <color> div {border-top-color: green} div {border-bottom-color: rgb(0,128,0)} border-color: <color>{1,4} transparent div {border-color: green #ff66cc rgb(128,128,128) #ee3} div {border-right-color: #ff66cc} div {border-left-color: #ee3} border-[top right bottom left]-style: hidden double solid dashed dotted ridge outset groove inset none div {border-top-style: double} div {border-bottom-style: outset border-style: <style>{1,4} div {border-style: solid dashed solid dotted} div {border-right-style: solid} div {border-left-style: dashed} border-[top right bottom left]: <width> <style> <color> div {border-top: solid red} div {border-right: thick double} div {border-bottom: red dashed blue} div {border-left: outset 10} border: <width> <style> <color> div {border: red solid 1} width: <length> <percentage> auto img {width: 40%} height: <length> <percentage> auto img {height: 100px}

Visual Formatting Model (normal & float) display: inline block list-item none p {display: block} b {display: inline} li {display: list-item} img {display: none} <img style='float: left'> float: left right none img {float: left} clear: left right both none img {float: left} <img style='float: left'> <img style='float: left'> <p style='clear: left'>

User Interface & Downloadble Font cursor: [<url>,]* [ auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help ] p {cursor : crosshair} p {cursor : url("mything.cur"), url("second.csr"), text} color: ActiveBorder ActiveCaption AppWorkspace Background ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText p {color: WindowText; background-color: Window} Downloadable Font <style type="text/css"> @font-face { font-family: "Robson Celtic"; src: url("http://site/fonts/rob-celt") } H1 { font-family: "Robson Celtic", serif } </style>

Media Types <style type='text/css'> @media print { body {font-size: 10pt; background-color: white}.iklan.menu {display: none} } @media screen { body {font-size: 12pt; background-color: yellow} } @media screen, print { body {line-height: 1.2} } </style> <style type="text/css" media="screen, print"> body {line-height: 1.2} </style> Recognized medias : all, aural, braille, embossed, handheld, print, projection, screen, tty, tv

Visual Effects overflow: visible hidden scroll auto div {overflow: auto} clip: <shape> auto div {clip: rect(5px, 10px, 10px, 5px)} visibility: visible hidden div {visibility: hidden} overflow: auto clip: rect(5px, 10px, 10px, 5px) visibility: hidden

Positioning Scheme position: static relative absolute fixed div {position: absolute} top right bottom left: <length> <percentage> auto div {top: 50} z-index: <integer> auto div {z-index: 2} static relative absolute fixed