Modul 12 CSS (Lanjutan)
Modul 12 CSS (Lanjutan)
BAB XII
CASCADINGSTYLE SHEET (CSS)
Contoh 2:
h1, h2, h3, h4, h5, h6
{
Color: green;
}
S1 Teknik Informatika
1
Modul Pemrograman Web 1
<html>
<head>
<style type="text/css">
body
{
background-image: url('myflower.gif');
background-repeat:repeat-y;
}
h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify; font-size: 125%; color:
red;}
</style>
</head>
<body>
<h1>Penggunaan Align pada CSS</h1>
<p class="date">Oktober, 2010</p>
<p class="main">Ketika saya masih terlalu muda dan
masih sangat rentan, ayah saya memberi nasihat "apabila
kamu dikritik oleh seseorang ingatlah bahwa semua orang
didunia tidak ada yang memiliki kelebihanmu ".
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> Try to resize the browser window to see
how justify works.</p>
</body>
</html>
Latihan 2 :
body {
color: #80c0c0;
S1 Teknik Informatika
2
Modul Pemrograman Web 1
background: black}
a:link { color: #ff8080 }
a:visited { color: #ff0000 }
a:active { color: #a05050 }
a.case1:link { background: green }
p:first-line { margin-left: 25px }
div.foo:first-line {
font-weight: bold;
margin-left: 30px }
div:first-letter {
font-size: x-large;
color: #ffffff }
ul ul li {
font-size: x-large;
font-decoration: italic }
h2 em { font-weight: 900 }
h2.ex1 {
color: green; /* This type of heading MUST
be Green and Large! */
line-height: 50px;
font-size: 40px }
.funkyclass {
font: 36pt/40pt courier;
font-variant: small-caps;
border: thick dashed blue }
#tagid1 {
padding: 20px;
border: 20px groove #ffffff }
.class1, #tagid2 { font-family: 'comic sans ms',
fantasy; color: rgb(100%,100%,0%) }
h1, h2, div.class5, blockquote { background: #000080 }
p.special {
font: 12pt/14pt sans-serif;
margin: 5px 0px 2px 25px;
border: medium dashed #ff0000;
background: white url(http://www.foo.com/image.gif)
repeat-x fixed top right }
blockquote {
margin-left: 2cm;
color: #00ff00 }
.part1 {
font-size: xx-large;
color: #808000 }
h5 {
font-size: xx-small ! important;
color: red ! important }
S1 Teknik Informatika
3
Modul Pemrograman Web 1
Latihan 3 :
q Buatlah file dibawah ini dengan menyisipkan file CSS yang dibuat tersendiri
diatas.
<html>
<head>
<title>Contoh CSS Link</title>
<link rel="stylesheet" TYPE="text/css"
href="style.css">
</head>
<body>
<h1 CLASS="funkyclass" ALIGN="center">Welcome to my
home page!</h1>
Hi there! If you are reading this then you have found
my home page! Congratulations! I know it can be hard
to find my pages, but I bet that you feel lucky now.
Now that you are here, please take a look at my page
of links to <a
HREF="http://www.mysite.com/coolsites.html">cool
sites</a> or sign my <a
HREF="http://www.mysite.com/guestbook.html">guest
book</a></p>
<div CLASS="foo"> My wonderful poetry <br> is
available if you are REALLY bored. Why not give it a
spin?</div>
S1 Teknik Informatika
4
Modul Pemrograman Web 1
<p CLASS="special"><span
CLASS="funkyclass">ADVERTISEMENT:</span> Buy Navel
Lint Contemplator! Its a browser and its a sandwich
spread! Go to our <a
HREF="http://www.navellint.com">home page</a> without
delay! Why? Because shelf life is only 8 hours unless
refrigerated. We know that makes it hard to browse,
but it promotes frequent upgrading to the latest and
greatest version. </p>
S1 Teknik Informatika
5
Modul Pemrograman Web 1
S1 Teknik Informatika
6