Welcome to Rockinliam's basic CSS tutorial.
This is a tutorial designed for people with zero knowledge of HTML or CSS, i hope that throughout the next 20 - 40 mins of your life i can enlighten you on the dark arts that is web development. What is CSS? CSS stands for Cascading Style Sheets and is used to define the Style or look of your website without the use of tables.
Part One: Setup
1) Firstly open up your HTML editing software, this maybe dreamweaver or notepad.
2) Create two new documents one named: index.html and the other named style.css
Part Two: Introduction to DIV tags.
In this tutorial we shall be creating divs. Divs (Divisions) define the structure of the webpage, they define the sizes of each section on your webpage how its coloured etc. In short DIV tags are probably the most important feature in css.
DIV's are structed like so:
Code: Select all
.divname {
feature:defintion;
}
Part Three: The main CSS code.
Open up your style.css
The main body:
Code: Select all
body {
background-color:#00FF00;
}
Underneath the code you have just written add this.
The wrapper:
Code: Select all
.wrapper {
width:850px;
margin:0 auto;
}
The banner:
Code: Select all
.banner {
width:850px;
height:125px;
background-color:#000000;
}
The Side Bar:
Code: Select all
.sidebar {
width:125px;
height:500px;
background-color:#FF0000;
float:left;
}
Content area:
Code: Select all
.content {
width:725px;
height:500px;
background-color:#FFFFFF;
float:left;
}
That is our incredibly basic CSS sheet complete, but now we must get it to work in a webpage.
Part Four: HTML
I hope you know a small amount of HTML, if not, it is not a problem.
HTML is not a programming language it is a markup language that define how text etc will look and how it will function.
HTML is started like so:
Code: Select all
<html>Code: Select all
</html>Input this HTML:
Code: Select all
<html>
<head>
<title>Basic CSS Tutorial</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="wrapper">
<div class="banner">
</div>
<div class="sidebar">
</div>
<div class="content">
</div>
</body>
</html>
Within the body of my HTML i implemented my Divs using "<div class="">" This tells the browser that i would like to style anything inside the Tag with my CSS. The div is then closed with the </div> tag. You may also notice that all my divs are inside my wrapper div, this is to keep my site together and centered.
You may now load your index.html in your browser and you should see a group of multi coloured boxes on the screen, congratulations this is your first styled webpage. Next time i will show you how to turn this from a group of boxes into a more substantial webpage.