View Full Version : I need a few CSS "parameters"

12-14-2002, 07:40 PM
Simple question, my thanks to whoever can help me out first. :D

I was just wondering how I'd declare the following in a CSS file: (ie. *.css)

- body: background color
- body margins: marginwidth, marginheight, leftmargin, rightmargin, topmargin, bottommargin
- body: text, link, vlink, alink

The answer is probably staring me in the face. :P Any and all help is appreciated.

Mr J
12-14-2002, 08:04 PM





12-14-2002, 08:10 PM
body {
background-color: #00CCFF;
margin: 0px;
padding: 0px;
margin-left: 0px;
/* apply the same to right, top and bottom for both margin and padding, e.g. padding-top: 0px; OR else do this: */
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
/* where it goes t r b l like a clock (12 3 6 9) */

p {
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 10px;
font-weight: bold;
font-style: italic;
color: #000000;
background-color: #EEEEEE;

a:link {
color: #330099;
text-decoration: underline;
a:visited {
color: #660099;
text-decoration: underline;
a:hover {
color: #0066FF;
text-decoration: underline;
a:active {
color: #330099;
text-decoration: underline;

Plenty more too, look here:


::] krycek [::

12-14-2002, 09:00 PM
Muchos gracias seniors :D

Pardon my French.

12-14-2002, 09:41 PM
Okay, hold on... another quick question. (Thanks for the link BTW, and I really like the quote.)

I have this:

.title {
font-weight: bold;
color: #344B5A;

It's a pre-defined <div></div> tag, for titles on my pages. I also have table cells with a certain background color. What I'd like to know...

<td width="100%" align="center" bgcolor="#BCC3C2">

Can I make the actual bgcolor color a variable I'd declare in my CSS file? For example:


cellcolor {
color: #000000


<td width="100%" align="center" bgcolor="cellcolor">

Make sense? (I don't want all cells to change color, just the one's I select... and I want that color to be declared in my CSS file. I was hoping to configure 2 colors, BTW.)

And again, you guys are the best.

12-14-2002, 10:04 PM
yes, you can... in two ways.

first, you can do it by using a server-side language such as PHP to insert the value you want, so that isn't gonna be exactly what you are after, I think.

second, you can create two or more classes that you can apply dynamically, e.g. swap them with JS. But, for that matter, you can swap them anyway, so you may not want to do it with class swapping unless you have more than one property to swap at once.

so for what you were asking, no, but yes it can be done, just a different way.

if you need scripts for the above, just choose you method and shout :)

::] krycek [::

12-14-2002, 10:32 PM
Since PHP isn't an option, I'd have to go with #2. :D

12-14-2002, 11:31 PM
okiedokie, well if you want to swap classes, then this script should do it:

function setClassName(element, className){
document.getElementById(element).className= className;

So, you basically setup something that just toggles the classes. For instance, if you want them to change when the mouse moves over, attach the function to the onMouseOver event.

Note that you have to pass a string to the element parameter, rather than an object reference.

::] krycek [::