07.35
0
Apakah itu CSS  ?
  • CSS stands for Cascading Style Sheets
  • CSS defines how HTML elements are to be displayed
  • Styles were added to HTML 4.0 to solve a problem
  • CSS saves a lot of work
  • External Style Sheets are stored in CSS files
Source :

1.1    Struktur utama CSS

body {
    background-color: #d0e4fe;
}

h1 {
    color: orange;
    text-align: center;
}

p {
    font-family: "Times New Roman";
    font-size: 20px;
}


1.2    cara memanggil file css dalam html

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

1.3    Contoh kode css dasar

1.     Contoh 1
body {
    background-color: lightblue;
}
h1 {
    text-align: center;
    color: red;
}

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

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

2.     Contoh 2
h1 {
    background-color: #6495ed;
}

p {
    background-color: #e0ffff;
}

div {
    background-color: #b0c4de;
}

3.     Contoh 3
body {
    background-image: url("bgdesert.jpg");
}

4.     Navigation bar
                
<ul>
  <li><a href="default.asp">Home</a></li>
  <li><a href="news.asp">News</a></li>
  <li><a href="contact.asp">Contact</a></li>
  <li><a href="about.asp">About</a></li>
</ul>


ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

li {
    display: inline;
}

li {
    float: left;
}

a {
    display: block;
    width: 60px;

0 komentar:

Posting Komentar