开发者

CSS not modifying link properties

Whatever I try to do, I can't modify the color of my links ( want to create a color rollover effect). They always stay the same default blue color with the underline effects. I know its something very minor that I did wrong, but can anyone tell me?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<style type="text/css">
body,
html {
    margin:0;
    padding:0;
    color:#101010;
    font-family: helvetica;


}

p {
    margin:10px 0 0 20px;
    font-size: 13px;
    line-height: 1.3em;
    padding-bottom: 10px;

}


#wrapper {
    width:960px;
    margin:0 auto;
    padding: 0px;
    background:#fff;
}
#header {
    padding:5px 10px;
    background:#fff;
    height:518px;


}

#nav {
    padding:5px 10px;
    background:#fff;
    width: 960px;
    height: 35px;
    position: absolute;
    top: 370px;
    font-size: 18px;
    color: #000;
}
#nav ul {
    margin:0;
    padding:0;
    list-style:none;
    position: absolute;
    bottom: 5px;
}
#nav li {
    display:inline;
    margin:0;
    padding:0;
    width:160px;
    float:left;


#nav li:hover {
    background-color: #faffd8;
    border-color: #004f7b;


}

#nav a {

    color: #000;
    text-decoration: none;
}


#nav a:link {
    color: #333333;
    text-indent: -9999px;
    text-decoration: none;


}

#nav a:hover {
    color: #000000;
    text-decoration: none;



}

#nav a:visited{
    color: #999999;
    text-decoration: none;


}

#nav a:active {
    color: #000000;
    text-decoration: none;

}

#topcontent p
{
    color: #444444;

}


}
#leftcontent {
    float:left;
    width:480px;
    height: 1%;
    background:#fff;
}
h2 {
    margin:10px 0 0 20px;
    color: #24389b;
    font-size: 19px;
    padding-bottom: 8px;
}
#rightcontent {
    float:right;
    width:480px;
    background:#fff;
    height: 1%;
}
#footer {
    clear:both;
    padding:5px 10px;
    background:#fff;
}
#footer p {
    margin:0;
}
* html #footer {
    height:1px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="header"><img src="pold.png" alt="Pold Logo" /></div>
<div id="nav">
    <ul>
        <li><a href="Research">Research</a></li>
        <li><a href="Research">Publications</a></li>
        <li><a href="Research">Software</a></li>
        <li><a href="Research">People</a></li>
        <li><a href="Research">Volunteer</a></li>
        <li><a href="Research">Resou开发者_运维问答rces</a></li>
    </ul>
</div>
<div id="topcontent">
    <p>The interests of our lab are generally centered around....</p>
</div>
<div id="leftcontent">
    <h2>Funded Projects</h2>
        <p><a href="url">The Cognitive Atlas</a><br />(funded by NIMH )<br />The Cognitive Atlas project aims to develop an ontology for cognitive processes through social collaborative knowledge building.</p>

</div>
<div id="rightcontent">
    <h2>Center Grants</h2>
    <p><a href="url">Consortium for Neuropsychiatric Phenomics</a><br />(funded by NIH)<br />This Roadmap Interdisciplinary Research Consortium is leveraging the new discipline of phonemics to understand neuropsychiatric disorders at multiple levels, from genes to neural systems to </p>

</div>
<div id="footer">
</div>
</div>
</body>
</html>

New Edit 09/27:

All. I apologize for posting twice -- I'm brand new here and didn't think to continue on this thread. As indicated on my post (see Sparky672's link), I'm having problems with my columns and my navigation looking how I want it. Please see this link for a demo http://rich2233.host22.com/pold.html .. I guess you can grab the code from your browser. Thanks for your help


**#nav li {
    display:inline;
    margin:0;
    padding:0;
    width:160px;
    float:left;**


#nav li:hover {
    background-color: #faffd8;
    border-color: #004f7b;


}

#nav a {

    color: #000;
    text-decoration: none;
}


#nav a:link {
    color: #333333;
    text-indent: -9999px;
    text-decoration: none;


}

#nav a:hover {
    color: #000000;
    text-decoration: none;



}

#nav a:visited{
    color: #999999;
    text-decoration: none;


}

#nav a:active {
    color: #000000;
    text-decoration: none;

}

**#topcontent p
{
    color: #444444;

}


}**

** check starred CSS Styles there no closing for first CSS style also extra closing for last one


You're missing a curly brace in this block:

#nav li {
    display:inline;
    margin:0;
    padding:0;
    width:160px;
    float:left;


Because your CSS only specifies the color of the links contained within the #nav <div>. All other links on page will be default color/style.

EDIT:

Not sure exactly which links you're talking about though. If you're talking about your navigation links, then see the others' answers pointing out the fact that you have a misplaced bracket } in your CSS.

If you're talking about the other links on the page, see my original answer above. You have no CSS for those links.


You missed some close-braces } that I fixed them by editing your question. Another Issue in your code is that should create css for A in this order:

a {}
a:link {}
a:visited {}
a:hover {}
a:focus {}
a:active {}

to take effect. just change your A styles ordering and it'll work correctly.


I think it has to do with the fact that you are not referencing your ul correctly, could be wrong though. Anyway take a look at this.

<style>
ul#navlist li{
list-style:none;
}
ul#navlist li a:link {text-decoration: none}
ul#navlist li a:visited {text-decoration: none}
ul#navlist li a:active {text-decoration: none}
ul#navlist li a:hover
{
color: #cccccc;
background-color: #003366;
border: 1px #ffffff inset;
}




</style>

<div id="navcontainer">

<ul id="navlist">
<li><a href="#">Item one</a></li>
</ul>

</div>

I kind of mix and mashed from my reference and your example and I think this is what you are looking for. Oh and if you didn't know by this point, your braces are messed up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜