There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
CASCADING Style sheets?


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Corrosive's Avatar
Senior Member with 1,074 posts.
 
Join Date: Jan 2003
Location: Scotland
04-Mar-2003, 02:09 PM #1
CASCADING Style sheets?
This is more of an interestign question than a problem, so I apologise if I've posted in the wrong place.

Anyway, CSS. Cascading Style Sheets, right? I understand why the "Style Sheet" part came about, but why on earth did they put the "cascading" part? What is "cascading" in these sheets?
__________________
"Computer games don't affect kids - I mean, if Pacman affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
- Kristian Wilson [Nintendo Executive 1989]

Anyone fancy going out clubbing tonight?
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
04-Mar-2003, 09:58 PM #2
Best way to understand why they are cascading is to look up the defintion for cascading

"A succession of stages, processes, operations, or units."

and then the definition for succession

"The act or process of following in order or sequence."


Then you can use the definitions to elaborate, but just don't take the definitions too directly.

a direct interpretation could be.

say you have to define your link atrributes for the whole document. you define

a:link
a:visited
a:active
a:hover.

Then if you want to define another set of link attributes to be used for just certain links, you could define the next set as

a.c2:link
a.c2:visited
a.c2:active
a.c3:hover

then another set

a.c3
a.c4 etc.

see the sequence?

That's too literal of a interpretation though.

Another way you could interpret it would be

you have different stages (attributes) that are set and they are interpreted by the browser in sequence from the top of the style sheet to the bottom.

Or you could take it as just going down a line.

just cascade your browser windows to see what i mean by that..

that's my thoughts on that. I'm sure others will have a different interpretation.

I was unable to find an exact definition of Cascading when used with style sheets.

hope that helps
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run

Last edited by Shadow2531 : 04-Mar-2003 10:12 PM.
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
04-Mar-2003, 11:24 PM #3
I was always under the impression that cascading referred to the way the style would be consistent throughout all of the pages that use a specific style sheet and the format cascades from the first to the last page.
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
04-Mar-2003, 11:35 PM #4
Thanks Rockn. I forgot all about the obvious.

That's probably the best definition.
Corrosive's Avatar
Senior Member with 1,074 posts.
 
Join Date: Jan 2003
Location: Scotland
05-Mar-2003, 01:30 PM #5
Thanks guys. I've wondered about it for a while but have only just remembered to ask about it LOL
deuce868's Avatar
Senior Member with 638 posts.
 
Join Date: Nov 2000
Location: MI
07-Mar-2003, 03:40 PM #6
actually, what I have read is this:

if you have a styles like this:
.red
{
color: red;
}

and

.large
{
font-size: x-large;
}

and used them like this:
PHP Code:
<div class="red"Testing <span class="large">this</spanstuff </div
The red color tag would cascade to the inner span style so the text "this" would be both large and red.

Unless redefined, a particular elemet of a style will continue to cascade into as many properties as you use.
__________________
www.ricksweb.info
www.2webheads.com
Quote:
Techies just think a little differently...at least that's what they keep telling me.
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
12-Mar-2003, 01:20 AM #7
thanks deuce868
juryu's Avatar
Junior Member with 18 posts.
 
Join Date: Feb 2003
Location: Rio
14-Mar-2003, 09:57 PM #8
By the way, if I define different links like Shadow2531 said, how do I make the links appear in the way I want?
For example I thought that

&lt;p class=c1&gt;
&lt;a href="blah"&gt;blah&lt;/a&gt;
&lt;/p&gt;

This link should have the attributes of a.c1, but it doesn't, it has the attributes of normal a. The only way I can get the different attributes is if I write

&lt;a class=c1 href="blah"&gt;

But it is soooo boring to do this on every link...
deuce868's Avatar
Senior Member with 638 posts.
 
Join Date: Nov 2000
Location: MI
14-Mar-2003, 10:18 PM #9
you can redefine the default style for links by just redifining the A property.


PHP Code:

a
:link
{
  
color:red;
}
a:visited
{
  
colorblue;
}
a:hover
{
  
coloryellow;
}
a:active
{
  
colorred;

Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
15-Mar-2003, 01:01 AM #10
juryu

If you are going use a different set of link attributes, besides the default, then your second method of calling the class inside the a tag is the correct way to do it. It is boring, but the usual way to do it.

I think there is another way to do it, but not sure. I think you might be able to put a certain amount of code between div tags and set a different link default class for that code.

I will see if I can find how to do it.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
15-Mar-2003, 02:05 AM #11
I figured it out.

Define an anchor id and set the color attribute.

Call the id using a div tag.

Then every link inside the open and close div tags, will be that color.

That should be what you want. However it's an absolute color. It doesn't change color depending on if you clicked on the link before.

I am not sure how to define the link, visited, active, and hover attributes with an anchor id; if you even can.

I setup a page in the next reply as an example. View source to see.

Ok I take that back, you can use the attributes. At least one at a time. I have to figure out how to do them all.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run

Last edited by Shadow2531 : 21-Mar-2003 01:32 AM.
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
15-Mar-2003, 02:39 AM #12
not sure if this is the PROPER method of accomplishing the task, but here is an example of how you can accomplish it with

a:link
a:visited
a:hover
a:active

for it to work right, you need to set them in that order.

(view source to see how it's done.)


All the test links on that page point to www.google.com so if you have google in your history, clear your history so you can see the 3 different colors.

I set the link to white, the visited link to blue and the hover to purple. I didn't set the active in the example.


I may start using this method myself.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run

Last edited by Shadow2531 : 21-Mar-2003 01:33 AM.
deuce868's Avatar
Senior Member with 638 posts.
 
Join Date: Nov 2000
Location: MI
15-Mar-2003, 08:18 AM #13
they have to be in order of lvha in order for them not to interfere with each other...is that what was messing with your active?
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
15-Mar-2003, 10:59 AM #14
I know you guys are on to something else beyond my knowledge, but according to W3C, it got its name because multiple styles CASCADE into one style (the .css file).
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
16-Mar-2003, 12:53 AM #15
thanks deuce868 for the order info. When I was trying to figure out how do accomplish that, I put the active before the hover, so yep, that inproper order was messing up the active.


thanks brendandonhu for another defintion! Could you throw up the link to the w3c page that has the definition, if you got it. (just for good measure)
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
Reply


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

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

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

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:52 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.