Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   Improve your ranking, submit to directories   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-11-2006, 11:36 PM   #1 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Simple guide to CSS

This is tutorial/guide mainly for people who have minimal experience with CSS (Cascading Style Sheets) and want to learn a bit out about it. CSS is a stylesheet language that formats the presentation of a document written in a markup language (e.g. HTML, XHTML, XML). CSS has a number of advantages one of the main ones being the presentation of websites can be held in one place, therefore making it really simple to update webpages. Style sheets make sites load faster and doesn't use require much bandwith. CSS specifications are maintained by W3C (World Wide Web Consortium).

Adding stylesheets within the HTML file:
Quote:
<html>
<head>
<title></title>
<style type="text/css">
body {
color: white;
background-color: #000000;
}
</style>

</head>

<body>
[etc...]
</html>
Style sheets in CSS is made up of rules, and each of these rules has three parts to it.

- the Selector (example: 'body') : specifies which part of the document will be affected by the rule

- the Property (example: 'color' and 'background-color') : specifies what aspect of the layout is being set

- the Value (example: 'white' and '#000000'): gives the value for the property

Note: color values can be defined using hexadecimal notation to learn more about this go to this website - http://www.w3schools.com/html/html_colors.asp

Grouping selectors and rules:

Instead of having this:
Quote:
body {color: white}
body {background-color: #000000}
We can have this:
Quote:
body { color: white;
background-color: #000000 }
Just by using ';' to separate the properties.

OR

Instead of having this:
Quote:
H1 { font-style: bold }
H2 { font-style: bold }
H3 { font-style: bold }
We can have this:
Quote:
H1, H2, H3 { font-style: bold }
Will be adding more to this very soon.
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-12-2006, 01:44 AM   #2 (permalink)
Individualist
 
John Scott's Avatar
 
Join Date: 09-27-03
Location: Japan, mostly
Posts: 42,297
iTrader: 3 / 100%
John Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster material
Send a message via AIM to John Scott Send a message via Yahoo to John Scott
Thanks mate
John Scott is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-13-2006, 01:31 AM   #3 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Quote:
Originally Posted by JohnScott
Thanks mate
Np, I'm going to post the next part tomorrow just been a bit busy.
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-13-2006, 02:11 AM   #4 (permalink)
Inactive
 
wongpk's Avatar
 
Join Date: 07-14-05
Posts: 68
iTrader: 0 / 0%
Latest Blog:
Car Pool

wongpk is a jewel in the roughwongpk is a jewel in the roughwongpk is a jewel in the roughwongpk is a jewel in the roughwongpk is a jewel in the roughwongpk is a jewel in the rough
mind if I continue it a little bit? Just to share my experience on CSS.

For body part, mostly I will use below code, so that I don't need to change th text style on the table I'm going to create:

Code:
body { font-family: Verdana, Tahoma, Arial, San Serif; font-size: 8pt; background: #ffffff; }
You can use background image too, but this code:

Code:
background-image: url(images/background.jpg);
For the font-family, the more font you choose the better, cause not all computer has the same font like your computer
wongpk is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-13-2006, 09:08 PM   #5 (permalink)
aka Colleen
 
Join Date: 03-25-04
Location: Canada
Posts: 5,925
iTrader: 0 / 0%
Latest Blog:
None

Kalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest order
Then to make this even better, we will toss in some short-hand CSS.

Change this:
Code:
body { font-family: Verdana, Tahoma, Arial, San Serif; font-size: 8pt; background: #ffffff; }
To:

Code:
body { font: normal 8pt/1.2 Verdana, Tahoma, Arial, San-Serif; background: #fff; color: #000; }
Where it says "normal" you can leave blank or put "bold" or "italic".

8pt is the font size, it can be any number really, just depends how big you want your text, and you can use pt, em, px or % for the size.

1.2 is the line-height, how much space is between your lines, and 1.2 is about standard, 1.3 is nice too.
__________________
Ruby Jewelry Sales
Kalina is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-14-2006, 09:53 AM   #6 (permalink)
aka Colleen
 
Join Date: 03-25-04
Location: Canada
Posts: 5,925
iTrader: 0 / 0%
Latest Blog:
None

Kalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest orderKalina is a web professional of the highest order
After a good nights rest, I realised I need to post the next handy short hand CSS as I see people doing this in their CSS and it's not necessary.

Don't do this:
Code:
body { background-color: #FFFFFF; background-image: url(images/bg.gif); background-position: 0 30px; background-attachment: fixed; background-repeat: no-repeat; }
Do this:
Code:
body { background: #fff url(images/bg.gif) 0 30px no-repeat fixed; }
Shorter, faster, simpler, same results.

For positioning the background, Firefox requires the horizontal value (left center right) declared first, then the vertical (top middle bottom);

So you can have words instead of numbers as well.
Code:
body { background: #fff url(images/bg.gif) left top no-repeat fixed; }
__________________
Ruby Jewelry Sales
Kalina is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-20-2006, 10:31 PM   #7 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Very nice info there, keep them coming.
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-20-2006, 10:32 PM   #8 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Inserting a Style Sheet

There are a number of ways you can apply style sheets to a web page.

Inline styles:

To use inline styles you place a 'style' attribute in a HTML tag. The 'style' attribute can state any CSS information. Here is an example:

Quote:
<p style=”color: blue; font-sizer: 12pt”>
What a nice sentence this is</p>
You can see how inside the 'style' attribute the style sheet language format is similar to the examples above. You still need a ';' to seprate the properties.

Internal Style Sheets:

Usually internal style sheets are placed in between the head tags in a HTML document. With the use of <style> tags CSS can be applied. An example on an internal style sheet:

Quote:
<head>
<style type=”text/css”>
body {background-color: #900000;
text-family: arial;
text-size: 12pt}
</style>

</head>
Internal style sheets are usually used when the web master wants to give a certain look for a certain web page that differentiates from others in a web site.


External Style Sheets:


Probably the most popular way of applying style sheets, with external style sheets you create a separate document that contains all the CSS information. While in the HTML document <link> tags need to be placed so the browser can read the information from the style sheet document. The <link> tags need to placed in between the <head> tags.

Example:
Quote:
<head>
<link rel= ”stylesheet” type=”text/css” href=”funkstyle.css” />
</head>
In the 'href' attribute you insert the name of your style sheet file and the browser will read the information in that file and format accordingly. Your style sheet file needs to be saved with the .css extension. The style sheet document doesn't need any <style> tags because it has already been saved as a CSS extension. A simple example of what a style sheet file can look like:

Quote:
body {background-image: url(“image/discostu.jpg”);
font-family: arial;
font-size: 12pt}
p {color: blue;
font-family: aria}
h1 {font-size: 14pt}
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-03-2006, 12:27 AM   #9 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Background Properties

In CSS background properties lets you set the background color for a web page and an image for the background. With the image background you are able to position the image, and also repeat the image horizontally or vertically.

Examples

Background Color:
Quote:
body {background-color: blue} -> Color Name Value

body {background-color: #0000FF} -> Hexadecimal Values

body {background-color: rgb(0,0,255)} -> RGB Values
All of these properties do the same thing, they set the background color of the web page to blue. People have a choice of how they assign their value.

Note: A link to CSS Color Values

Background Image:
Quote:
<style type="text/css">
body {background-image: url('waterbg.jpg')}
</style>
This basically assigns the image from the given URL, the URL is placed between brackets after the text 'url' as shown in the example.

Repeating a Background Image:
Quote:
<style type="text/css">
body {background-image: url('waterbg.jpg');
background-repeat: repeat-x}
</style>
This background image is repeated horizontally, to repeat the image vertically simply replace repeat-x with repeat-y.
Quote:
<style type="text/css">
body {background-image: url('waterbg.jpg');
background-repeat: repeat}
</style>
This repeats the image horizontally and also vertically.

Background Position:

The property for positioning images on backgrounds is; background-position. The values for background-position can be in the form of percentages (e.g. background-position: 100% 50%), length (e.g. background-position: 0px 30px), and keywords (e.g. background-position: right center). In all cases the horizontal position is specified first and the vertical position second. So for example the values 100% 0% will be positioned on the top right corner of the page.

Single Image on a Background:
Quote:
<style type="text/css">
body { background-image: url('circle.gif');
background-repeat: no-repeat;
background-position: center; }
</style>
With this a single image, in this case a little circle would appear in the center of the page.

To have the image fixed at a certain point so it will not scroll with the rest of the page, just add this property to the body selector; background-attachment: fixed.

This link directs to a table that contains most background properties and values: CSS Background Properties Table
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-10-2006, 11:06 PM   #10 (permalink)
Inactive
 
Join Date: 01-26-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

Rifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebodyRifat is liked by somebody
Import Style Sheets

This is another way of applying a style sheets to a web page, very similar to external style sheets. You need to have a separate CSS file that contains all the the CSS information.

Quote:
<style type="text/css" media="all">
@import url("mystyle.css");
p {background-color: blue;}
</style>
The @import has to be placed before all other rules.
Rifat is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-11-2006, 07:39 AM   #11 (permalink)
Moderator
 
cldnails's Avatar
 
Join Date: 02-16-06
Location: Evansville, IN
Posts: 2,786
iTrader: 0 / 0%
cldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest ordercldnails is a web professional of the highest order
Send a message via ICQ to cldnails Send a message via AIM to cldnails Send a message via MSN to cldnails
This thread just got bookmarked. Thanks everyone, as I'm just starting to utilize CSS from scratch.
__________________
Spy Pic Blog & Forum - Did I mention there would be punch and pie?
My Affiliate Blog
you get me closer to god
cldnails is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
A new SEO guide searchbliss SEO Forum 0 07-08-2006 11:38 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 11:18 PM.
© Copyright 2008 V7 Inc