• Tidak ada hasil yang ditemukan

External Style Sheets can save a lot of work

N/A
N/A
Protected

Academic year: 2018

Membagikan "External Style Sheets can save a lot of work"

Copied!
31
0
0

Teks penuh

(1)

CSS

(2)

What is CSS ?

C

ascading

S

tyle

S

heets

Styles define

how to display

HTML elements

Styles were added to HTML 4.0

to solve a

problem

External Style Sheets

can save a lot of work

(3)

CSS Color Names

See on :

(4)

CSS Syntax

p {color:red; text-align:center;}

<!DOCTYPE html> <html>

<head> <style>

p {

color:red;

text-align:center; }

</style> </head>

<body>

<p>Hello World!</p>

<p>This paragraph is styled with CSS.</p>

(5)

CSS Comments

/*This is a comment*/

p

{

text-align:center;

/*This is another comment*/

color:black;

(6)

CSS Id and Class

<!DOCTYPE html> <html>

<head> <style>

#para1 /* Tanda # digunakan sebagai penanda ID*/

{

text-align:center; color:red;

}

</style> </head>

<body>

<p id="para1">Hello World!</p>

<p>This paragraph is not affected by the style.</p>

(7)

CSS Id and Class

<!DOCTYPE html>

<html>

<head>

<style>

.center

/* Tanda . digunakan sebagai penanda Class*/

{

text-align:center;

}

</style>

</head>

<body>

(8)

CSS Background

CSS background properties are used to define

the background effects of an element.

CSS properties used for background effects:

background-color

background-image

background-repeat

(9)

CSS Background (2)

<!DOCTYPE html> <html>

<head> <style> body {

background-color:#b0c4de; }

</style> </head>

<body>

<h1>My CSS web page!</h1>

<p>Hello world! This is a W3Schools.com example.</p>

(10)

CSS Background (3)

<!DOCTYPE html> <html>

<head>

<style> h1 {

background-color:#6495ed;} p {

background-color:#e0ffff; } div {

background-color:#b0c4de;} </style>

</head>

<body>

<h1>CSS background-color example!</h1> <div>

This is a text inside a div element.

<p>This paragraph has its own background color.</p> We are still in the div element.

</div>

(11)

CSS Text Color

<!DOCTYPE html> <html>

<head> <style>

body {color:red;} h1 {color:#00ff00;}

p.ex {color:rgb(0,0,255);} </style>

</head>

<body>

<h1>This is heading 1</h1>

<p>This is an ordinary paragraph. Notice that this text is red. The default text-color for a page is defined in the body selector.</p>

(12)

CSS text-alignment

<!DOCTYPE html> <html>

<head>

<style>

h1 {text-align:center;} p.date {text-align:right;} p.main {text-align:justify;} </style>

</head>

<body>

<h1>CSS text-align Example</h1> <p class="date">May, 2009</p>

<p class="main">In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p> <p><b>Note:</b> Resize the browser window to see how the value "justify" works.</p>

</body>

(13)

CSS Text Decoration

<!DOCTYPE html>

<html>

<head>

<style>

a {text-decoration:none;}

</style>

</head>

<body>

<p>Link to: <a href="http://www.w3schools.com">W3Schools.com</a></p>

</body>

(14)

CSS Text Decoration (2)

<!DOCTYPE html> <html>

<head> <style>

h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} </style>

</head>

<body>

<h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3>

</body>

(15)

CSS Text Transformation

<!DOCTYPE html> <html>

<head> <style>

p.uppercase {text-transform:uppercase;} p.lowercase {text-transform:lowercase;} p.capitalize {text-transform:capitalize;} </style>

</head>

<body>

<p class="uppercase">This is some text.</p> <p class="lowercase">This is some text.</p> <p class="capitalize">This is some text.</p>

(16)

CSS Text Indent

<!DOCTYPE html> <html>

<head> <style>

p {text-indent:50px;} </style>

</head> <body>

<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>

(17)

CSS Font Family

<!DOCTYPE html> <html>

<head> <style>

p.serif{font-family:"Times New Roman",Times,serif;} p.sansserif{font-family:Arial,Helvetica,sans-serif;} </style>

</head>

<body>

<h1>CSS font-family</h1>

<p class="serif">This is a paragraph, shown in the Times New Roman font.</p> <p class="sansserif">This is a paragraph, shown in the Arial font.</p>

(18)

CSS Font Style

<!DOCTYPE html> <html>

<head> <style>

p.normal {font-style:normal;} p.italic {font-style:italic;}

p.oblique {font-style:oblique;} </style>

</head>

<body>

<p class="normal">This is a paragraph, normal.</p> <p class="italic">This is a paragraph, italic.</p>

<p class="oblique">This is a paragraph, oblique.</p>

</body>

(19)

CSS Set Font Size With Pixels

<!DOCTYPE html> <html>

<head>

<style>

h1 {font-size:40px;} h2 {font-size:30px;} p {font-size:14px;} </style>

</head> <body>

<h1>This is heading 1</h1> <h2>This is heading 2</h2> <p>This is a paragraph.</p>

<p>Specifying the font-size in px allows Internet Explorer 9, Firefox, Chrome, Opera, and Safari to resize the text.</p>

<p><b>Note:</b> This example does not work in IE, prior version 9.</p>

(20)

CSS Links

The four links states are:

a:link - a normal, unvisited link

a:visited - a link the user has visited

(21)

CSS Links (2)

<!DOCTYPE html> <html>

<head>

<style>

a:link {color:#FF0000;} /* unvisited link */ a:visited {color:#00FF00;} /* visited link */ a:hover {color:#FF00FF;} /* mouse over link */ a:active {color:#0000FF;} /* selected link */ </style>

</head>

<body>

<p><b><a href="default.asp" target="_blank">This is a link</a></b></p> <p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>

<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

(22)

CSS Link Text Decoration

<!DOCTYPE html> <html>

<head> <style>

a:link {text-decoration:none;} /* unvisited link */ a:visited {text-decoration:none;} /* visited link */

a:hover {text-decoration:underline;} /* mouse over link */ a:active {text-decoration:underline;} /* selected link */ </style>

</head>

<body>

<p><b><a href="default.asp" target="_blank">This is a link</a></b></p> <p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>

<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

(23)

CSS Link Background Color

<!DOCTYPE html> <html>

<head> <style>

a:link {background-color:#B2FF99;} /* unvisited link */ a:visited {background-color:#FFFF85;} /* visited link */

a:hover {background-color:#FF704D;} /* mouse over link */ a:active {background-color:#FF704D;} /* selected link */ </style>

</head> <body>

<p><b><a href="default.asp" target="_blank">This is a link</a></b></p> <p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>

<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

(24)

CSS Lists

<!DOCTYPE html> <html>

<head> <style> ul

{

list-style-image:url('sqpurple.gif'); }

</style> </head> <body>

<ul>

<li>Coffee</li> <li>Tea</li>

<li>Coca Cola</li>

</ul>

(25)
(26)

CSS Tables

<!DOCTYPE html> <html> <head> <style> #customers {

font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;

width:100%;

border-collapse:collapse; }

#customers td, #customers th {

font-size:1em;

border:1px solid #98bf21; padding:3px 7px 2px 7px; } #customers th { font-size:1.1em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#A7C942; color:#ffffff; }

(27)
(28)
(29)

CSS Menu Drop Down

<html xmlns = "http://www.w3.org/1999/xhtml"> <head>

<title>

Menu Drop-Down </title>

<style type = "text/css">

body { font-family: arial, sans-serif } div.menu { font-weight: bold;

color: white;

border: 2px solid #225599; text-align: center;

width: 10em;

background-color: #225599 } div.menu:hover a { display: block } div.menu a { display: none;

border-top: 2px solid #225599; background-color: white;

width: 10em;

text-decoration: none;

div.menu a:hover { background-color: #dfeeff }

</style>

</head> <body>

<div class = "menu">Menu <a href = "#">Rumah</a> <a href = "#">Berita</a> <a href = "#">Artikel</a> <a href = "#">Blog</a> <a href = "#">Kontak</a> </div>

(30)
(31)

CSS Image Gallery

<!DOCTYPE html> <html> <head> <style> div.img { margin: 5px; padding: 5px;

border: 1px solid #0000ff; height: auto; width: auto; float: left; text-align: center; } div.img img { display: inline; margin: 5px;

border: 1px solid #ffffff; }

div.img a:hover img {border: 1px solid #0000ff;} div.desc { text-align: center; font-weight: normal; width: 120px; margin: 5px; } </style> </head> <body> <div class="img"> <a target="_blank" href="klematis_big.htm"><img src="klematis_small.jpg" alt="Klematis" width="110" height="90"></a>

<div class="desc">Add a description of the image here</div>

</div> <div class="img"> <a target="_blank" href="klematis2_big.htm"><img src="klematis2_small.jpg" alt="Klematis" width="110" height="90"></a>

<div class="desc">Add a description of

</div> <div class="img"> <a target="_blank" href="klematis3_big.htm"><img src="klematis3_small.jpg" alt="Klematis" width="110" height="90"></a>

<div class="desc">Add a description of the image here</div>

</div> <div class="img"> <a target="_blank" href="klematis4_big.htm"><img src="klematis4_small.jpg" alt="Klematis" width="110" height="90"></a>

<div class="desc">Add a description of the image here</div>

Referensi

Dokumen terkait

[r]

[r]

Kebatalan yang diputuskanoleh hakim atas akta Notaris bisa berbentuk (1) batal demi hukum;atau (2) dapat dibatalkan. Disarankan kepada pemerintah dan pembuat Undang-undang

Sehubungan dengan Pel el angan Pemil ihan Langsung Pekerj aan Peningkat an Jal an Kant or Camat Mendahara - Sahbandar Kabupat en Tanj ung Jabung Timur Tahun Anggaran 2014, unt uk

Peserta yang memasukkan penawaran dapat menyampaikan sanggahan secara elektronik melalui aplikasi SPSE atas penetapan pemenang kepada Pokja dengan disertai bukti

Sehubungan dengan telah memasuki tahap pembuktian kualifikasi terhadap dokumen isian kualifikasi yang

Kurangnya penekanan guru pada penerapan aspek media pembelajaran, sangat dimungkinkan karena pemahaman dan keterampilan guru yang kurang baik terhadap arti

Dalam tulisan ini saya mencoba untuk memaparkan berbagai pemakna- an orang Islam di Indonesia terhadap al-Qur’an sebagai sebuah kitab yang berisi sabda-sabda Allah SWT