PDA

View Full Version : New to CSS can someone say what i did wrong?


kalisana
09-12-2006, 10:08 PM
Hi everyone,
I am new to CSS and still learning the basics, however, i am trying to apply CSS hyperlink styles to just one table but the "text-decoration: none" isn't working ... I know I didn't do this right to begin with as Iwas trying to figure it out myself so I'd be very garteful if someone could point me in the right direction and let me know what I'm doing wrong:

<head>
<style type="text/css">
#navigation {
a {text-decoration: none}
a:link {color: #0DE0ED}
a:hover {color: #FF9C00}
p {color: rgb(0,0,0)}
}
</style>
</head>

Thanks :)

drachir
09-12-2006, 10:20 PM
I see what you are doing, try this out.

<style type="text/css">
body{background: #000000;}
A:LINK { color: #3300cc; }
A:VISITED { color: #ffff00; }
A:ACTIVE { color: #ff0000; }
A:HOVER { color: #ffffff;}

You can change the link colors as you wish, don't forget to use proper javascript syntax. I think that mozilla has a Javascript console under tools to help you trouble shoot problems.

kalisana
09-12-2006, 10:34 PM
I see what you are doing, try this out.

<style type="text/css">
body{background: #000000;}
A:LINK { color: #3300cc; }
A:VISITED { color: #ffff00; }
A:ACTIVE { color: #ff0000; }
A:HOVER { color: #ffffff;}

You can change the link colors as you wish, don't forget to use proper javascript syntax. I think that mozilla has a Javascript console under tools to help you trouble shoot problems.

Thanks for your quick response! Unfotrunetly I am inserting this into a website which already uses the body tag so i cannot use the body tag... also the site doesn't allow me to apply styles to the entire page, so i want the style to apply only to a particular table, which i have named [#navigation... if i remove this bit:

#navigation{

}

everything works... but I need to assign this style to my table :( Inside my table I put

<table border="0" cellpadding="0" cellspacing="0" id="#navigation" style="background-color: #383838; border: 1 solid #000000">

so that the css style only applies to that table and not the whole page..
sorry, I'm not good with technical lingo so be patient with me :)

mark87
09-13-2006, 12:17 AM
You're using the wrong (um, don't know the correct word - syntax?)...

It should be like this:

#navigation a {
color: #F00;
text-decoration: none;
}

You'd also need to specify a value for the border size, eg. 1px.

kalisana
09-13-2006, 12:47 AM
ooohh.... I see what you mean.... let me try that! thanks :)

for the border, that table is inside another table and doesn't require a border around it, hence the border="0" value :)

VIPStephan
09-13-2006, 09:57 AM
But why are you doing this then?

<table border="0" cellpadding="0" cellspacing="0" id="#navigation" style="background-color: #383838; border: 1 solid #000000">

What mark was trying to tell you is that the latter style is doing nothing without a unit (px, em, whatever -> border: 1px solid #000;). However, this will go against the former border="0" in the same tag anyway...
If you want to apply styles to a table with another table this is the correct way:

table table {...}