Site hosted by Angelfire.com: Build your free website today!

alice tea

imaginings

Basic CSS Tutorial by Alice Tea

The following is a basic tutorial on CSS (cascading style sheets) properties. It is here I assume you already have knowledge of HTML. If not, check out BOOGIEJACK. He's got a great site! CSS not only helps you create your web page(s) faster, it also gives you a lot more possibilities than just straight HTML. Why? Because I said so! Ha-ha, seriously folks, by using CSS, you pretty much are inputting all the properties of your web page one time and one time only (of course, to every rule there is always an exception!). AND, by being able to position images and text EXACTLY where you want them, you can take your site to the limits of your imagination!

Before I go into the actual coding, I will explain what each part means. You start with <style type="text/css"> </style> in between the <head> tags of your HTML document. What goes in between the style tags looks like this:

selector {property: value}


NOW the fun begins! Oh, and by the way, if you used HTML to change the font to red, you would be inputting a lot of stuff! With CSS, it's much easier.. you'll see!


(NOTE: From here, what you see in RED is what you can change to your liking)
Firstly, we will cover BODY BACKGROUND properties, which include color, images, and image positioning. I'll show you how to input it, then I'll break it down.

BODY
{
background-color: white;
background-image: url(image url);
background-repeat: repeat-y;
background-position: left
background-attachment: fixed
}

  • BACKGROUND-COLOR... obviously, it's the uh, background color of your page. You can either use:
  • the name of the color [white]
  • rgb [rgb (0,0,0)] or
  • hex# [#FFFFFF]
  • CLICK HERE for a chart of colors!
  • note: I've found it to be a good idea to use a background color along with the background image because sometimes the image won't load. Just be sure to choose a color that will complement the text colors you choose =o)
  • BACKGROUND-IMAGE... the picture, or image you wish to place on your page
  • BACKGROUND-REPEAT... to create a tiled background, left border, etc.
  • repeat-y will place the image vertically, as for a side border
  • repeat-x will place it horizontally, as for top and/or bottom border
  • no-repeat will place the image just once on the page

  • BACKGROUND-POSITION... will position the image to the
  • left, right, or center
  • left top will place the image on the left and top of the page

  • BACKGROUND-ATTACHMENT...
  • fixed will keep it from scrolling
  • scroll will let it scroll


Next, let's cover how you will want the FONT STYLES to look throughout the page.

BODY, P, TD, I
{
color: black;
font-weight: bold;
font-family:arial, helvetica, times;
font-style: normal
font-size: 12pt
text-align: left
text-indent: .5 cm
cursor: crosshair OR cursor: url (cursor url)
}

  • BODY (text which goes into the body of the document), P (paragraph), TD (table text), I ( italicized text)
  • COLOR... what color you wish the text to be
  • FONT-WEIGHT...
  • BOLD
  • BOLDER
  • NORMAL
  • LIGHTER

  • FONT-FAMILY...
  • arial helvetica times is where you put the group of fonts you want to use (use commas in between each font)
  • FONT-STYLE...
  • normal ..**I added this into my italicized red info so it wouldn't be italicized
  • italics
  • FONT-SIZE... hey, it's the size! (what I'm using for my paragraphs is helvetica, arial 12pt
  • TEXT-ALIGN... how you want your text.. well... aligned
  • left
  • right
  • center
  • TEXT-INDENT: if you wish to indent the beginning of your paragraphs
  • CURSOR... you can choose different types of cursors, such as
  • crosshair
  • help
  • auto
  • default
  • all-scroll (there's more!). OR
  • you can choose a custom cursor and add the url where indicated

  • ***NOTE: Grouping the BODY, P, TD, I together will make all of those selectors be the same. Separate them to have them behave differently. For instance, to create the red text color, I didn't group it together with the rest, I gave it its own property: I {font-style: normal;color: red; font-weight: bold; arial; font-size: 12pt}

You with me so far? Good! Hmm.. about about if we cover LINKS?!? Okay!

A:link
{
color: blue; font: 12pt times; text-decoration: bold; cursor: crosshair
}
A:visited
{
color: red; font: 12pt times;text-decoration: none; cursor: crosshair
}
A:hover
{
color: goldenrod; font: 10pt times;text-decoration: bold;cursor: crosshair; background-color: whitesmoke
}

  • A:link... (the actual LINK hehe), you choose the COLOR, the type and size of FONT, if you want it BOLD, and the type of CURSOR
  • A:visited... (the link you've already uh.. visited). Hey pretty much the same as A:link!
  • A:hover... (when you place your cursor over the link). Notice I added a background-color of whitesmoke, which means exactly what it says, when you 'hover' over the link, the background color of that link will change to whitesmoke!


Oh! Oh! I know what we can do next! I've always found COLORED SCROLLBARS to be so awesome, haven't you? I thought so. Alrighty then, let's get to it!

BODY
{
scrollbar-face-color: red;
scrollbar-highlight-color: pink
scrollbar-3dlight-color: white
scrollbar-darkshadow-color: blue;
scrollbar-shadow-color: black;
scrollbar-arrow-color: pink;
scrollbar-track-color: linen
}

  • Awww do I HAVE to go into an explanation of where the face, highlight, 3dlight etc. colors correspond???

*** If you have or going to put in TEXTAREAS, you can also have those scrollbars colored as well... just use .FSB instead of BODY, and the rest (scrollbar-face-color etc.) is the same format.

Speaking of TEXTAREAS, you can manipulate the border color/style and background color/image to your liking as well! Check it out:

INPUT,TEXTAREA,SELECT
{
border: 1px solid;
color:black;
background-image: url(img url);
background-color:yellow
}

  • BORDER... 1px will give the thickness of the border, SOLID gives you the style, you can also use dotted, dashed
  • COLOR... is color of the border

  • BACKGROUND-COLOR/IMAGE corresponds to.. you guessed it, the background of the textarea! You can choose either color or image


And there you have the very basics. And even these basics haven't covered all the basics hehehe. I will continue adding to the site. If there's something I missed, or if there's something you'd like me to add, please EMAIL ME. Hopefully soon, I will start on some advanced tutorials, such as absolute vs. relative positioning, opacity options, table options... In the mean time, if you're up to it, visit CODEPUNK to get a good tutorial on advanced CSS!


MY OTHER SITE | LINKS | NEOFONTS | DRAWINGS | TATS | POETRY