[TUT]{SERIES - #1} Learn CSS

Status
Not open for further replies.

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
Welcome to The first tutorial on CSS. In the series of this tutorial, we will go very far in-depth on how to code CSS and integrate it with your HTML pages. If you are unfamiliar with HTML please click before proceeding with this tutorial.

Ways you can integrate CSS with your HTML page:


  • External Stylesheet This is the most common way to insert CSS into your page. When you have an external stylesheet you save it as a separate file with the extension ".css" You will also have to link your file to your HTML. Insert the following code into the <head> section of your HTML page.
    Code:
    <link rel="stylesheet"  href="[B]mystyle.css[/B]" type="text/css" />
    Replace the Bolded section with your CSS Sheet. Good ideas for a name are "main.css" "site.css" or "css.css".
  • Inline Stylesheet This is the least common way to insert CSS into your page and I highly discourage it. When you have an Inline stylesheet you code with
    Code:
    style=""
    attributes within the element you want to change. Just like the Following:
    Code:
    <p style="">
  • Internal Stylesheet When you want to make your page different from the other pages on the website you will use an Internal Stylesheet. You insert
    Code:
    <style>
    tags in the <head> section of your page and define in between them.
So now that we've cleared the air on that, we can move on.
Comments
To insert a comment in your CSS page (which makes it more neat and organized) type in
Code:
/*COMMENT HERE*/
anywhere in your External CSS document.

Using CSS on your Page
To use the CSS on your page you will need to use the
Code:
 <div>
Tag. On Your CSS Document You will need to determine whether it is an ID or a class. You can use an ID selector as follows
Code:
 #ELEMENTNAME
That will define an Id. If you wish to use a Class use the class selector as follows
Code:
 .ELEMENTNAME
In order to add the element characteristics into the page you need to specify on the div tag as follows.
Code:
 If ID: <div id="elementname">
If Class: <div class="elementname"
There is NO SELECTOR when you insert in the HTML page. Just class and id. You can also define actual HTML tags. It must be a REAL tag. When you define a tag there is no selector.
Code:
 body
is a REAL HTML tag. Whatever you define that tag and use the body tag on the page it will display.

CSS Syntax
You need to know the syntax in order for your code to work. Below is an example of the ID selector using CSS Syntax.
Code:
 #elementname {
Define your CSS codes here
}

In The Next Tutorial we will review quite more of the definitive codes.
 

Duck

New Member
Nov 19, 2010
52
1
Nice, I'm starting to learn CSS, I think I've got the hang of it, but this helped a lot, thanks! ;D
 

Dion1

Member
Nov 22, 2010
68
0
i do like youre tutorial 8/10 but if i look up to W3.org there u can learn the same no hating no flaming but it is kinda good of u to make a tutorial of it :D goodjob
 
Status
Not open for further replies.

Users who are viewing this thread

Top