S1 Teknik Informatika
CSS
“Ainul Yaqin, M.Kom”
www.ainulyaqin.com
Apa Itu CSS
www.company.com
CSS Memecahkan Masalah Besar
www.company.com
CSS SELECTOR
www.company.com
Cara Menggunakan CSS
• Inline Styles
• Embedded/Internal Style Sheets
• External Style Sheets
www.company.com
Inline Style
<html >
<head>
<title>Web Profile</title>
</head>
<body style="font-family:Arial;
background:#efefef">
<strong><h1 style="border-bottom:1px
solid #fff; font-family:Verdana">AINUL
YAQIN</h1></strong>
<img src="ainul.png" width="215" height="215" />
<p><strong>About Me</strong></p>
<p>Hello, This My Profile</p>
<p>I'm Researcher, System Analist, Programmer
and Web Developer. I have interest in AI
Research.</p>
</body>
</html> www.company.com
Embedded/Internal Style
<style>
h2 {
color: green;
text-decoration:underline;
}
blockquote {
border-left: 5px solid orange;
padding-left: 10px;
font-style:italic;
color:#666
}
</style>
www.company.com
External Style
• exsternal Style sangat ideal bila gaya ini diterapkan untuk banyak
halaman. Dengan gaya eksternal sheet, Anda dapat mengubah
tampilan seluruh situs dengan mengubah hanya satu file.
• Setiap halaman harus menyertakan link ke style sheet dengan
tag <link>. <Link> tag masuk ke dalam bagian kepala:
<head>
<link rel="stylesheet“
type="text/css" href="styles.css" />
</head>
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
www.company.com
}
Contoh External Style
www.company.com
Style1.css
@charset "utf-8";
/* CSS Document */
h2 {
color: green;
text-decoration:underline;
}
blockquote {
border-left: 5px solid orange;
padding-left: 10px;
font-style:italic;
color:#666
}
img {
border-radius:50%;
border: 5px solid #00f;
}
www.company.com