|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm setting up my first CSS page and am having a problem I do not understand.
I set up my CSS page "test.css" like this:<STYLE TYPE="text/css"> BODY {background-color: #C4C4C4} H1 {font-family: serif; font-style: italic; font-weight: 900; font-size: xx-large; color : #CC3300} H2 {font-family: Fantasy; font-style: normal; font-weight: 700; font-size: large; color : #666699} P {font-family: Arial, Helvetica, sans-serif; font-style: normal; font-size: x-small; color : #993366} B {background-color: #FFFFFF; font-size: medium} </STYLE> If I copy this code directly into my <HEAD> section, it all works as expected, but when I replace this with a <LINK REL="test.css"> statement, the background and bold styles do not work while all the rest work the same. Any ideas??? Joel |
|
#2
|
|||
|
|||
|
Use this exactly as it appears below:
P { Font-Family : Arial, Helvetica, Sans-serif ; Font-Size : X-small ; Color : #993366 ; Font-Style : Normal } H1 { Font-Family : Serif ; Font-Size : XX-large ; Color : #CC3300 ; Font-Style : Italic ; Font-Weight : 900 } H2 { Font-Family : Fantasy ; Font-Size : Large ; Color : #666699 ; Font-Style : Normal ; Font-Weight : Bold } BODY { Background-Color : #C4C4C4 } B { Font-Size : Medium ; Background-Color : white } Also to link to it in the head section, use: <link rel="stylesheet" type="text/css" href="text.css"> That should solve you're problem. Hope it helps! I think you just had the syntax wrong seeing as it's differnt in the .css file than it is when put into the actual page. Happy coding! ------------------ -Colin Anderson http://www.htmletc.net/ "There are two ways to write error-free programs. Only the third one works." |
|
#3
|
|||
|
|||
|
Thanks Colin...unfortunately, not quite there yet.
What I noticed is that whatever is first (in my first example it was BODY which started this whole mess because it would not show the background color. In your example it was P, which then failed to provide its own definition and instead inherited the last definition displayed before it which was H2 --- whatever is first is being ignored. I changed it around to test it out and this proves to be true. (i.e. when I put H1 first it ignored that but did everything else.) Is there some order of precedence that has to be followed or maybe a standard statement or something that I am missing? Joel |
|
#4
|
|||
|
|||
|
dont know if this helps, but, of course, in your .css file, you dont need the <style> or </style> tags... it tricked me at first...
cheers darwin oh yeah, you need a closing ; before the } too. [This message has been edited by darwin (edited December 15, 2000).] |
|
#5
|
|||
|
|||
|
Thanks, it was the <style> tags inside the .CSS file, so all appears well, at least for the time being!
Thanks again, Joel |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS Link and Background problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|