PDA

View Full Version : CSS style problem



fightonusc61
Jan 28th, 2007, 08:24 PM
Any help is greatly appreciated. I am trying to have multiple link styles on my page but it won't allow me too. Here is the CSS code for this:

.style61 {

color: #F5F5F5;

font-weight: bold;

font-size: 20px;

font-family: "Comic Sans MS",
cursive;

}

a.style61:link {color: #F5F5F5;
font-size: 20px;
font-weight: bold;
font-family: "Comic Sans MS",
cursive;
}

a.style61:hover {text-decoration: underline;}

a:link {
color : #00336F;
text-decoration: none;
}

a:visited{
color : #00336F;
text-decoration: none;
}
a:hover{
color : #00336F;
text-decoration: underline;
}


And some example text I am using (just for testing) is: <p><span class="style61"><a href="html">html</a></span></p>

The text won't show up with the class=style61 css link styles. Please help with this

koyama
Jan 28th, 2007, 08:52 PM
Hi fightonusc61,

Try to put the class within the a element instead


<p><a class="style61" href="html">html</a></p>

Class names are not inherited by child elements. On the other hand, many css properties are inherited by child elements. :confused:

fightonusc61
Jan 28th, 2007, 08:58 PM
thanks for the suggestion koyama, but sadly it didn't change it.

What is strange is that the link will accept all of the other properties from the style EXCEPT the color. The color comes up as #00336F, which I need all the other links to be, but this is just for the navigation, and I need that color to be #F5F5F5. But it won't recognize this color

_Aerospace_Eng_
Jan 28th, 2007, 08:59 PM
Post your current html.

fightonusc61
Jan 28th, 2007, 09:02 PM
Post your current html.

The css is above and the current html is <p><a class="style61" href="html">html</a></p> for example text.

As mentioned above, it will recognize the other properties from the style61 css code EXCEPT the color. But I need the color to be different

koyama
Jan 28th, 2007, 09:17 PM
It is working for me...

You maybe have some styles that are overriding previously assigned ones. As Aero says, we need to see a live example.

Excavator
Jan 28th, 2007, 09:32 PM
Hello fightonusc61,
Look at my example here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.style61 {
color: #00FF00;
font-weight: bold;
font-size: 20px;
font-family: "Comic Sans MS",cursive;
}
a.style61:link {
color: #F5F5F5;
font-size: 20px;
font-weight: bold;
font-family: "Comic Sans MS",cursive;
}
a.style61:hover {
text-decoration: underline;
}
a:link {
color : #00336F;
text-decoration: none;
}
a:visited{
color : #00336F;
text-decoration: none;
}
a:hover{
color : #00336F;
text-decoration: underline;
}
</style>
</head>
<body>
<p class="style61"><a href="http://www.nopeople.com">html</a></p>
<p><a href="http://www.nopeople.com"><span class="style61">html</span></a></p>
<p class="style61">Web Design by <a href="http://www.nopeople.com">nopeople.com</a></p>
</body>
</html>


You can see that the actual link, "html" in your example, is not styled yet.
In my second example, enclosing "html" with the span tag is not really the way to do it. Instead, style the link now with something like this:



.style61 a:link, .style61 a:visited, .style61 a:active {
color: #CCCCCC;
}
.style61 a:hover {
color: #FFFFFF
}

fightonusc61
Jan 28th, 2007, 09:34 PM
yes, something is overriding it and I'm not sure what or why.

The page is here: http://www.colorado.edu/AFROTC/

Notice on the homepage the link comes up as blue

(ignore how the other links looksfor now, the current way they are set up is hard to edit so that is why I am doing this)

However, click on the "Links" page and the font color comes up fine. This is weird. Why does it work on the links page and some other pages but not on the home page and some other pages?

Excavator
Jan 28th, 2007, 09:52 PM
Maybe I'm not understanding the problem completely but look at this:

<p><a class="style61" href="html">html</a></p>
<p><span class="style17"><span class="style16"><a href="http://www.colorado.edu/AFROTC">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="60" height="19">
<param name="BGCOLOR" value="#00336F" />
<param name="BGCOLOR" value="#00336F" />

<param name="BGCOLOR" value="#00336F" />
<param name="movie" value="http://www.colorado.edu/AFROTC/Templates/home.swf" />
<param name="quality" value="high" />
<embed src="http://www.colorado.edu/AFROTC/Templates/home.swf" width="60" height="19" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#00336F" ></embed>
</object>
</a></span></span></p>
<p class="style16"><span class="style12"><span class="style19"><a href="http://www.colorado.edu/AFROTC/prospective_cadets/index.htm">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash

I only mention this because I'm dyslexic, the two style names are so close and all the other links are displayed right.

Excavator
Jan 28th, 2007, 09:59 PM
Some other problems your having and are probably not aware of yet.

It doesn't validate (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.colorado.edu%2FAFROTC%2F)

fightonusc61
Jan 28th, 2007, 10:04 PM
I fixed the problem. I deleted ALL of the coding, both the html and the CSS, related to the sidebar and redid it from scratch using some of the recommendations made here. Problem is fixed. Whatever the conflict was it is gone now. Whoever originally coded it just had too many different things in different places and I just whiped it clean and started over. Works fine.