CSS For Beginners
![]() ![]() ![]() |
CSS For Beginners
| Gareth |
Jun 28 2005, 10:41 AM
Post
#1
|
|
Mr. Bling Bling :P Group: Members Posts: 7,555 Gender: Male ------------------ Donate CFX Creds CFX Credits: 10,736 ------------------ Member No.: 1 Reputation: 184 pts |
CSS is short for 'Cascading Style Sheets', and is a part of current web standards. You can control most apects of your website design from one CSS sheet. Lets begin,
Basics CODE body{ background-color:#000000; } This controls the background color of your website, you should change '#000000' to the color that you want the background of your website to be. Classes If you want to define unique sets of attributes for seperate parts of your site then you will have to make use of classes. These are defined as follows: CODE .bigfont{ font-family:Arial, Helvetica, sans-serif; font-size:30px; } - The '.' tells us that this is a new class, you can change the fonts and sizes to your liking, now in your html file if you use the code below then your text will have the attributes that you defined in the CSS sheet: CODE <font class="bigfont">This text will have the attributes defined in the css sheet.</font> ID's IDs work in similar ways to classes, except that they can only be used once (whereas classes can be used multiple times), so only use IDs for unique properties. ID's are mainly used to incorporate Style Sheet models into JavaScript or DHTML, here's an example of how to use ID's: CODE #bigfont{ font-family:Arial, Helvetica, sans-serif; font-size:40px; } Now in your html file you would use: CODE <font id="bigfont">This is big text.</font> Note we now use 'font id' instead of 'font class'. Linking to External CSS Once you have your CSS Sheet made, you will want to encorporate it into your website, to do this place the code below within your 'head' tags: CODE <link rel="stylesheet" type="text/css" href="sheet.css" media="all" title="Your Title" /> You should swap 'sheet.css' with the name of your CSS Sheet, and also swap 'Your Title' with your own title. Well, thats all the basics covered, enjoy. |
|
|
|
| WinSrev |
Jun 28 2005, 03:00 PM
Post
#2
|
|
CodedFx Legend! Group: Coders Posts: 1,420 Gender: Male ------------------ Donate CFX Creds CFX Credits: 9,260 ------------------ Member No.: 2 Reputation: 31 pts |
font is also the same as span:
CODE <span class="bigfont">This text will have the attributes defined in the css sheet.</span> To make your css look neater i would probalise use this setup: CODE .bigfont { font-family:Arial, Helvetica, sans-serif; font-size:30px; } |
|
|
|
| Gareth |
Jun 28 2005, 03:03 PM
Post
#3
|
|
Mr. Bling Bling :P Group: Members Posts: 7,555 Gender: Male ------------------ Donate CFX Creds CFX Credits: 10,736 ------------------ Member No.: 1 Reputation: 184 pts |
Ok, thanks for the extra info.....i'm still relatively new to css aswell :)
|
|
|
|
| skandalouz |
Jul 8 2005, 10:20 PM
Post
#4
|
|
Loyal Member Group: Members Posts: 496 Gender: Not Telling Sotw Wins: 2 ------------------ Donate CFX Creds CFX Credits: 419 ------------------ Member No.: 70 Reputation: 41 pts |
nice, but i think i will stick to plain html for now, i mean most of the stuff i can do in html, and the only advantage i know of is using one file for multiple pages
|
|
|
|
| Gareth |
Jul 8 2005, 10:51 PM
Post
#5
|
|
Mr. Bling Bling :P Group: Members Posts: 7,555 Gender: Male ------------------ Donate CFX Creds CFX Credits: 10,736 ------------------ Member No.: 1 Reputation: 184 pts |
QUOTE(skandalouz @ Jul 8 2005, 11:20 PM) But that is a very big advantage. |
|
|
|
| RockyNguyen |
Aug 5 2005, 02:13 PM
Post
#6
|
|
Newbie Group: Members Posts: 7 Gender: Male ------------------ Donate CFX Creds CFX Credits: 7 ------------------ Member No.: 754 Reputation: none |
That was a pretty good tutorial. Thanks because I didn't know much CSS until I read this.
|
|
|
|
| freelancer |
Sep 24 2005, 04:52 AM
Post
#7
|
|
Newbie Group: Members Posts: 2 Gender: Not Telling ------------------ Donate CFX Creds CFX Credits: 2 ------------------ Member No.: 255 Reputation: none |
Nice helpful tutorial :D |
|
|
|
| Simon |
Dec 16 2005, 04:58 PM
Post
#8
|
|
Member Group: Members Posts: 42 ------------------ Donate CFX Creds CFX Credits: 42 ------------------ Member No.: 2,049 Reputation: 1 pts |
QUOTE(skandalouz @ Jul 8 2005, 11:20 PM) (With a little PHP) I think it is possible for a user to select between different CSS Stylesheets, giving them more control as to how they view your site. This can be as simple as larger fonts for those who cant see well or a completly different colour scheme. Also, I remember reading somewhere that there was a tag like this: CODE p {color: #000000 !important;} Where the "!important" part will set the attributes set in those particular {} brackets will not be overridden by a subsequent rule. Which can always be pretty handy. |
|
|
|
| DoubleJ |
Dec 18 2005, 12:44 AM
Post
#9
|
|
i might be a coder.... i think... Group: VIP Members Posts: 339 Gender: Not Telling ------------------ Donate CFX Creds CFX Credits: 13,508 ------------------ Member No.: 856 Reputation: 14 pts |
QUOTE(Simon @ Dec 16 2005, 06:58 PM) (With a little PHP) I think it is possible for a user to select between different CSS Stylesheets, giving them more control as to how they view your site. This can be as simple as larger fonts for those who cant see well or a completly different colour scheme. Also, I remember reading somewhere that there was a tag like this: CODE p {color: #000000 !important;} Where the "!important" part will set the attributes set in those particular {} brackets will not be overridden by a subsequent rule. Which can always be pretty handy. There is a javascript based styleswitcher that enables you to let a user switch between different preset stylesheets for one page. And depending on the way you coded your site and used styling(like NO tables for the layout) can make your stylesheets show extremely different websites while content remains the same. I had a styleswitcher on my site once to but at version 3 I got it of my site. Maybe I will return it when I add more styles to my site, but for now here is the article about the switcher: http://www.alistapart.com/articles/n4switch/ and if you want to see what CSS can really do you should certainly give: http://www.csszengarden.com a try. |
|
|
|
| RiplasH |
May 6 2006, 07:20 AM
Post
#10
|
|
Member Group: Members Posts: 36 ------------------ Donate CFX Creds CFX Credits: 36 ------------------ Member No.: 4,201 Reputation: 8 pts |
CSS...
Never really knew hat it even stood for. so thanks. this helped ^_^ |
|
|
|
| Tom |
Dec 10 2006, 07:09 PM
Post
#11
|
|
Dedicated Member Group: Members Posts: 842 Gender: Male ------------------ Donate CFX Creds CFX Credits: 1,272 ------------------ Member No.: 5,944 Reputation: 10 pts |
Just a 'lil error: under the topic "Linking to an external Stylesheet, you missed a space beween the: " and the / at the end.
Should be " /> |
|
|
|
| Gareth |
Dec 10 2006, 07:53 PM
Post
#12
|
|
Mr. Bling Bling :P Group: Members Posts: 7,555 Gender: Male ------------------ Donate CFX Creds CFX Credits: 10,736 ------------------ Member No.: 1 Reputation: 184 pts |
QUOTE(Tommeh @ Dec 10 2006, 08:09 PM) Just a 'lil error: under the topic "Linking to an external Stylesheet, you missed a space beween the: " and the / at the end. Should be " /> Of course, fixed and thank you :) |
|
|
|
| Pistol |
Dec 19 2006, 05:17 AM
Post
#13
|
|
Advanced Member Group: Members Posts: 57 ------------------ Donate CFX Creds CFX Credits: 38 ------------------ Member No.: 259 Reputation: none |
How do you put an image url instead of a background color (Seems more simple to make a CSS Whit simply making the image in PS, add text in PS then Make a CSS and add the rest :)
|
|
|
|
| That Negative Guy |
Dec 19 2006, 10:55 PM
Post
#14
|
|
Dedicated Member Group: Members Posts: 903 Gender: Not Telling ------------------ Donate CFX Creds CFX Credits: 6,824 ------------------ Member No.: 3,091 Reputation: 105 pts |
QUOTE(Pistol @ Dec 18 2006, 09:17 PM) How do you put an image url instead of a background color (Seems more simple to make a CSS Whit simply making the image in PS, add text in PS then Make a CSS and add the rest :) CODE .class { background: url('path/to/image.jpg'); } |
|
|
|
| Pistol |
Dec 20 2006, 02:10 AM
Post
#15
|
|
Advanced Member Group: Members Posts: 57 ------------------ Donate CFX Creds CFX Credits: 38 ------------------ Member No.: 259 Reputation: none |
thank you very much :)
|
|
|
|
![]() ![]() ![]() |