Search This Blog

Saturday 12 November 2016

Pengenalan CSS


*CSS
CSS merupakan kumpulan format yang digunakan untuk memformat website agar dapat lebih flexibel.

Elemen Dasar
1. Selector (Tag / elemen pada HTML).
2. Declaration (Perintah CSS untuk menjelaskan desain selector, yang isinya antara lain property dan value.

Format penulisan : Selector { property: value;}


*Penulisan CSS

Inline CSS
<p style=’color: blue’>Text ini berwarna biru</p>

Internal / Embedded CSS
<style>
p{color: blue;}
</style>

External CSS
<link rel=’stylesheet’ type=’text/css’ href=’file_CSS.css’>

*Jenis CSS

a). Font CSS
b). Text CSS
c). Padding CSS
d). Margin CSS
e). Border CSS
f). Background CSS

a). Font CSS
1. font-family
2. font-size-adjust
3. font-weight
4. font-variant
5. font-style
6. font-size
7. font-stretch

<style>
p{
font-family: Georgia;
font-size: 12pt;
}
</style>

b). Text CSS
1. Color
2. Direction
3. Letter-spacing
4. Text-align
5. Text-Decoration
6. Text-shadow
7. Text-indent
8. Word-spacing
9. White-space
10. Text-transform

<style>
p{
color: red;
text-align: center;
letter-spacing: 2px;
}
</style>

c). Padding CSS

<style>
p{
padding: 10px 5px 10px 5px;
}
</style>

d). Margin CSS

<style>
p{
margin-top: 20px;
}
</style>

e). Border CSS

1. Border (none, hidden, solid, dotted, dashed, double, groove, ridge, inset, outset).
2. Border-color.
3. Border-style.
4. Border-width.

<style>
p{
border: 2px dotted gray;
}
</style>

f). Background CSS

1. Background-attachment
2. Background-color
3. Background-image
4. Background-position
5. Background-repeat

<style>
p{
Background-image: url(‘img/1.jpg’);
Background-attachment: fixed;
}
</style>

No comments:

Post a Comment