The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
CSS Class Question
Discuss CSS Class Question in the CSS Help forum on Dev Shed. CSS Class Question Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 20th, 2002, 03:59 PM
|
|
Contributing User
|
|
Join Date: Feb 2002
Location: Bako, CA
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
CSS Class Question
The CSS file that I am creating is going really well, but I'm stuck on a part that I am not sure what to do. I have tried many, many differnet things and am not able to get it to work.
What I want to do is make all <td>'s by default the color WHITE unless otherwise specified. I have some <td>'s that I want "#183cad" color code. Here is my current CSS File:
***********
BODY
{
FONT-SIZE: small;
BACKGROUND: url(images/bg.gif) #000000 fixed;
MARGIN: 0px;
HEIGHT: 0pt
}
A:visited
{
FONT-WEIGHT: normal;
FONT-SIZE: 12px;
COLOR: #000000;
FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
TEXT-DECORATION: none
}
A:link
{
FONT-WEIGHT: normal;
FONT-SIZE: 12px;
COLOR: #000000;
FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
TEXT-DECORATION: none
}
A:active
{
FONT-WEIGHT: normal;
FONT-SIZE: 12px;
COLOR: #000000;
FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
TEXT-DECORATION: none
}
A:hover
{
FONT-WEIGHT: normal;
FONT-SIZE: 12px;
COLOR: #183cad;
FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
TEXT-DECORATION: underline
}
TD
{
background-color: white;
}
*******************
How do I code in here to specify "#183cad" for different <td>'s ??
Any help would be greatly appreciated!!!!!!!!
|

February 20th, 2002, 04:02 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
|
try using classes or unique ids.
i.e.
<td class="class1"></td>
and
<style>
td { background-color: <your default color here> }
.class1 { background-color: #183cad }
</style>
or for the ids:
<td id="firsttd"></td>
<style>
#firsttd, #secondtd, #thirdtd { background-color: #183cad }
</style>
|

February 20th, 2002, 04:18 PM
|
|
Contributing User
|
|
Join Date: Feb 2002
Location: Bako, CA
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
I have tried both the CLASS and ID Tags within my HTML code to call the funtion in my .css file. I am using an inline CSS File, does this matter? Or does it have to be done a differnet way? Now my CSS File looks like so....
*******************
td
{
background-color: white }
.blue { background-color: #183cad }
*********************
That's just the last piece. Is that right? If so, it doesn't work. Thanks in advance!!
|

February 20th, 2002, 04:25 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
|
if you use <td class="blue">...</td> it should work since the last definition should override the first.
it should not matter (in some rare cases it does though) if you use inline css or a linked (<link rel="stylesheet"...>) css.
there is some other misunderstanding. there is no functions in css...
if you experience problems on a specific browser only, try not setting up a default color but adding class or id properties to ALL <td> tags.
|

February 20th, 2002, 04:38 PM
|
|
Contributing User
|
|
Join Date: Feb 2002
Location: Bako, CA
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
I can't believe I'm having this hard of a time getting this to work hahaah. Anyways, I took into consideration your suggestion on not setting a default color for <TD>'s. So I used the following code in my .css file:
********************
TD
{
.white { background-color: white }
.blue { background-color: #183cad }
}
*******************
Should this code work?
|

February 20th, 2002, 04:41 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
try yourself. i am busy answering other peoples questions right now 
|

February 20th, 2002, 04:42 PM
|
|
Contributing User
|
|
Join Date: Oct 2000
Location: Back in the real world.
|
|
|
aaaaah sorry, i think you got the syntax messed up.
it should be:
TD.white { background-color: white }
TD.blue { background-color: #183cad }
|

February 20th, 2002, 04:42 PM
|
|
Contributing User
|
|
Join Date: Feb 2002
Location: Bako, CA
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
Well I did try it ;-) And it didn't work for some reason. I'll just keep playing with it. Thanks alot for your support!!!
|

February 20th, 2002, 04:46 PM
|
|
Contributing User
|
|
Join Date: Feb 2002
Location: Bako, CA
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 12
|
|
|
AHH HAY! You are the man :-)
Thank you much
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|