如何将我的按钮链接到正确的位置

时间:2012-04-16 20:42:21

标签: html css

好的我正在用HTML / Css做一个网站 问题是当我点击" Home"按钮它指示我到我的CSS链接。 我的主页名为" new.html"当我点击" home"那就是我希望它去的地方。而不是background.css 这是我的" New.html"

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="background.css"/>
    </head>
    <h1>Bully-Free Zone</h1>
    <h2>"Online harassment has an off-line impact"</h2>
    <a href="background.css" class="nav-link">Home</a>
    </body>
    </html>

background.css

body{/* IE10 */ 
background-image: -ms-linear-gradient(top left, #FC5B5B 0%, #555BB5 100%);

/* Mozilla Firefox */ 
background-image: -moz-linear-gradient(top left, #FC5B5B 0%, #555BB5 100%);

/* Opera */ 
background-image: -o-linear-gradient(top left, #FC5B5B 0%, #555BB5 100%);


/* Webkit (Chrome 11+) */ 
background-image: -webkit-linear-gradient(top left, #FC5B5B 0%, #555BB5 100%);

/* Proposed W3C Markup */ 
background-image: linear-gradient(top left, #FC5B5B 0%, #555BB5 100%);
}
h1{color:black;text-align:center;font-size:40px;font-family:broadway;
}
h2{color:black; text-align:center;font-size:35px;font-style:italic;}
a{color:black; text-align:left; font-size:25px;font-family:broadway;}
a.nav-link:link
{
 color: black;
 text-decoration: none;
}
a.nav-link:visited
{
 color: black;
 text-decoration: none;
}
a.nav-link:hover
{
   color: black;
   text-decoration: none;
}
a.nav-link:active
{
   color: black;
   text-decoration: none;
}

3 个答案:

答案 0 :(得分:3)

不明显?改变这个:

<a href="background.css" class="nav-link">Home</a>

到此:

<a href="new.html" class="nav-link">Home</a>

计算机只执行被告知的操作。

答案 1 :(得分:1)

更改

<a href="background.css" class="nav-link">Home</a>

为:

<a href="new.html" class="nav-link">Home</a>

您还应该插入

<body>

之前

<h1>

答案 2 :(得分:0)

更改此行:

<a href="background.css" class="nav-link">Home</a>

<a href="new.html" class="nav-link">Home</a>