The best part about Web Dev! ;)
A CSS rule set consists of a selector and a declaration block:
For example,
p {
color: red;
text-align: center;
}
What does the P mean?
What if you want just one paragraph to follow a particular style?
#para1 {
text-align: center;
color: red;
}
.center {
text-align: center;
color: red;
}
And the code goes here,
div {
width: 300px;
padding: 25px;
border: 25px solid navy;
margin: 25px;
}
Total element width = width + left padding + right padding + left border + right border + left margin + right margin
Remember!
Step 1: Add the list items
<ul id="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Login</a></li>
</ul>
Step 2: Make it horizontal
#nav {
margin:20px;
padding:0;
list-style:none;
width:525px;
}
Style the list:
Style the list items:
ul#nav li {
display:inline
}
ul#nav li a {
text-decoration:none;
padding:5px 0;
width:100px;
background:#485e49;
color:#eee;
float:left;
}
Step 4: Finishing touches
//Adds seperators
ul#list-nav li a {
text-align:center;
border-left:1px solid #fff;
}
//Changes color on hover
ul#list-nav li a:hover {
background:#a2b3a1;
color:#000
}
And you're done!
The CSS color palette
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
That's all for now! :)
Get in touch:
Just the beginning.
Much more to learn, much more fun.