导航栏中的链接颜色不可更改

时间:2015-09-12 03:48:59

标签: html css html5 css3 hyperlink

这是我的代码  `                   我的个人网站     

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>legacycitizens</groupId>
    <artifactId>RLCitizens</artifactId>
    <version>1.0</version>

    <repositories>
        <repository>
            <id>techcable-repo</id>
            <url>http://repo.techcable.net/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>net.techcable</groupId>
            <artifactId>npclib</artifactId>
            <version>LATEST</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>net.techcable.npclib</pattern>
                            <shadedPattern>legacycitizens.libs.npclib</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我无法更改导航栏中的链接。 这是必须更改链接颜色但不能

的代码
<style>
    html body{
        margin:0;
        padding:0;
        }
    .navbar-container {
        position: absolute;
        top:0;
        width: 100%;
        background-color: #283018;
        }
    .navigation-bar {
        padding: 10px;
        }

    .nav-ul {
        padding-top: 7px;
        overflow:hidden;
        padding-left: 540px;
        list-style-type:none;

        }

    .nav-ul  li {

        color: white;
        display: inline;
        padding:50px;
        text-align: center;
        font-size: 1.1em;
        float:left-inline;

        }
     .navbar-name h1    {
        color: white;
        float:left;
        padding-left: 2px;
        font-size: 1.5em;
        }

    .navbar-links a:link {
        color: white;
        text-decoration:none;
        }
    li a:link {
        color:white;
        }
    .navbar-links li:hover, .navbar-links a:hover  {
        background-color: blue;
        }


</style>

<body>
    <nav class="navbar-container">
        <div class="navigation-bar">
        <div class="navbar-name">
            <h1>Welcome to My Personal Site</h1>
        </div>
        <div class="navbar-links">
            <ul class="nav-ul">
                <li><a href="#">Home</a></li>
                <li><a href="#">Profile</a></li>
                <li><a href="#">My Works</a></li>
            </ul>
        </div>
        </div>
    </nav>
</body>
</html>`
我甚至试图放 .navbar-links a:link { color: white; text-decoration:none; } 但它不起作用

链接颜色不可更改。

抱歉,我无法发布截图

1 个答案:

答案 0 :(得分:1)

试试这个

.navbar-links li a {
    color: white;
    text-decoration:none;
 }