CSS Course Notes

written by:Sadi Evren SEKER

CSS, stands for Cascading Style Sheet. It is used for formatting HTML files. They can be used by both internal and external methods. In fact, we can define the format of a HTML file by 4 different methods:
1. Browser Settings: You can define the colours, font or format of HTML files by browser settings.
2. Internal CSS format: CSS definitions between <style> ... </style> tags
3. External CSS format: CSS definitions from external files.
4. Inline format: you can set the format inside html tags.
This tutorial contains only 2nd and 3rd methods. Following is a simple CSS example:
/* This is a comment */
text-align: center;
/* This is another comment */
color: black;
font-family: arial

/* ... */ keeps the comments inside.
we have formatted the <p> tag which keeps the format of paragraph, by this CSS. Format of <p> tag after this CSS is centered, black coloured, and in arial font.
  • Main idea behind this coding is the below syntax:
    tagname { formatname:formatvalue }
  • for more than one formatname, you should seperate the names by semicoloumn(;)
    tagname {formatname1:formatvalue1;
  • you can group more than one tags in a single css entry:
    tagname1,tagname2,tagname3... {formatname1:formatvalue1}
  • you can define more than one type of same tag:
  • you should use the same class name in html:
    <tagname class="classname1">tagvalue</tagname>
    <tagname class="classname2">tagvalue</tagname>
  • Like the classes, id is used to differentiate the tagnames
    *#idname {formatname:formatvalue}
  • The rule above will match any tagname: <tagname id="idname">Some text</tagname>

    CSS in Action

  • first html file
  • first css file
  • Second html file
  • Second css file
    Last updated:06/04/2003 20:55, by Sadi Evren SEKER