Connecting Tech Pros Worldwide Forums | Help | Site Map

newb questions

Newbie
 
Join Date: Jun 2008
Posts: 12
#1: Jun 29 '08
please forgive these questions if they are obvious, but if you dont mind clearing something up for me:

1. is it possible to include html or javascript inside a css file? if so what is the format?

2. is it possible to use the hover or link properties of one css element to change the properties of another css element which is not a subset of the first element? (eg?)

thanks for your indulgence...

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,579
#2: Jun 29 '08

re: newb questions


No to both.

Always keep in mind that CSS is not a programming language and cannot modify anything. CSS stands for "style sheet".
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#3: Jun 29 '08

re: newb questions


Would
Expand|Select|Wrap|Line Numbers
  1. #element1:hover #element2 {
  2.     color: red;
  3. }
  4.  
Not work?
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,579
#4: Jun 30 '08

re: newb questions


He said not on a "subset" of another element.
Newbie
 
Join Date: Jun 2008
Posts: 12
#5: Jun 30 '08

re: newb questions


righto . . .

if i had
<span id ="element1">
<a href="#null">something</a></span>
</span>

<span id="element2">some stuff</span>

then the above-mentioned css wouldn't do anything...
(right?)
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,579
#6: Jun 30 '08

re: newb questions


Correct. It's the "cascade" part of CSS. If you want to refer to other elements of the page, then you would need to reference the DOM (Document Object Model), and the only way to do that is with javascript, a programing language.

There are "selectors", in CSS, which are methods of affecting sibling elements in the same cascade, from parent through child, but I don't think that's what you want.
Newbie
 
Join Date: Jun 2008
Posts: 12
#7: Jul 1 '08

re: newb questions


thanks for the lesson . . .

crystal clear now . . .
Reply