ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Whats CSS?



The Boosh!

ClioSport Admin
  Elise, Duster
Dont link me to websites as iv already googled and read and i still dont really understand what it/they are. I have aquired a copy of dreamweaver as im hoping to learn how to make sites by building my own website so im just going to learn the basics first... There is an option called create new CSS? In lamens terms - what are these and what do you use it for? /n00b :eek:
 
  DCi
basically they are ways of formating things quickly (although they are quite a lot more powerful once you get going)

for example your name is light blue on this forum so you'd have a style called blue_font
then another for green mods and another for orange admins... that is quite a simple example...

but say if you were making the font bigger, bolder and a new colour instead of having to type those 3 things each time you did it you could just define it in your CSS once then just write style="name_of_style" etc etc.
 

DMS

  A thirsty 172
Yes.
CSS = cascading style sheets.
In a nutshell, you reference a .css file in the header of a web page which then downloads in the background. The web page then refers to the .css file to apply formatting to areas of a page.
That means that instead of coding in the specific colour options, font sizes, font faces, formatting options, etc... you can just reference a "style" which has been pre-defined in the .css file.
It speeds up and tidies up coding, speeds up web page load times (by only downloading the formatting code once) and helps keep a uniform appearance across all pages on a given web site.

EDIT: I'm sure someone will be along shortly to try and tell me I'm wrong, but that's the basic jist of it.
 

The Boosh!

ClioSport Admin
  Elise, Duster
Thanks for that - Cleared it up quiet a bit for me! So would it be worth me trying to incorporate a CSS style sheet into my webpage i build :)
 

DMS

  A thirsty 172
If you're only making one or two web pages I wouldn't bother.
If you're making a full blown site with loads of content then yeah I'd say it's worth it.
 
  172
CSS just defines how DOM elements should appear. They can be inline, included in the page source or called externally.

Back in the olden days it was regular to see this type of thing
<p><font color="red" size="10px">my text here<p>
CSS came along which meant styles could be attributed to the DOM element in 3 different ways

Inline in the tag
<p style="font-color:red;font-size">my text here<p>

Inline in the HTML
In the<head> tag:
<style type="text/css">
p {
font-color:red; font-size:10px;
}
</style>

In the body:
<p>my text here<p>
Or externally

In a CSS file
p {
font-color:red; font-size:10px;
}

In the<head> tag:
<link rel="stylesheet" type="text/css" href="mycssfile.css" />

In the body:
<p>my text here<p>
The preferred method is externally as it keeps your HTML tidier.

CSS should also be used for positioning. In the olden days (some people still do!, people used tables for positioning, it ideally should be done with CSS.

CSS is both an angel and a devil though!
 
Last edited:
nobody will be saying your wrong darren_stone, as your completely right.

As said its for formatting an entire website the same by using styles and divs which align the layout of the page exactly the same every time you use a selected style or div.

If its only a small website and your a beginner dont bother unless you like to be neat and are going to expand.
 

KDF

  Audi TT Stronic
In a nutshell (proper version)

CSS was meant to solve all the cross browser style/layout inconsistencies... it didn't.
 
  20VT Clio & 9-5 HOT
CSS and HTML/PHP should be kept seperate for cleaner code!


at the top of your HTML (or whatever) page in the header have a link to your CSS sheet:

HTML:
<link href="css/style.css" rel="stylesheet" type="text/css" />
The in your HTML page have items with CSS ID's and Classes such as:

HTML:
<div id="topbox"> this box is square </div>
or

HTML:
<p class="bluefont"> This text is blue </p>
then in the seperate style.css sheet for this items you would have something like (note # for ID's and . for classes):

HTML:
#topbox { width:100px;height:100px;float:left;border 1px solid #000000;padding 10px; }

.bluefont { color:#004a80;font-weight:bold: }
You can do so much with CSS. and you can also have different CSS files for different browsers! You pretty much code an entire site with CSS and HTML. No need for old fashioned tables for layout etc! Just use DIV's that have the right CSS properties!

The difference with ID's and classes is an ID is suppose to be a unique occurance, wheras you can have lots of things on one page each with the same class! You can get away with classes for everything pretty much.
 


Top