0

我刚开始使用 CSS,在为链接添加颜色时遇到了一些麻烦。当我添加链接颜色时它不起作用,所以我尝试自己修复它,但只会让我的网站更加混乱。这是我的代码。

<html>
    <head>
    <title> website </title>
    </head>
    <style type="text/css">
body 
    {
      background-color:#474747;
      color:#e1e1e1;
      font-family:"Courier New";
      text-align:center;
    {
      a:link
    {
      color:#00FFFF;}    /* unvisited link */
      a:visited
    {
      color:#4DFF4D;} /* visited link */
      a:hover
    {
      color:#00FFFF;}   /* mouse over link */
      a:active
    {
      color:#00FFFF;}  /* selected link */
    }
h1
    {
      font-size:40;
    }
h3
    {
      font-size:20;
      text-decoration:underline;
    }
p
    {
      font-size:12;
    }
    </style>
    <body>
    <h1> heading </h1>
    <hr size="3" color="red" />
    <h3>Welcome!!!</h3>
    <p>Welcome to my website!</p>
    <h3>Links</h3>
    <p><a href="http://www.youtube">Youtube</a></p>
    </body>
</html>

它是在 Html 代码中还是在 Css 编码中?请帮忙。

4

2 回答 2

1

首先正确地关闭你的牙套,让我们知道这是怎么回事

body 
{
    background-color:#474747;
    color:#e1e1e1;
    font-family:"Courier New";
    text-align:center;
{

应该

body 
{
  background-color:#474747;
  color:#e1e1e1;
  font-family:"Courier New";
  text-align:center;
}
于 2013-03-14T22:45:07.080 回答
0

有一个命令可以对锚伪状态进行样式化。

a, a:link, a:visited {
    /* any links, unvisited links, visited links*/
}
a:hover, a:visited:hover, a:active, a:focus {
    /* any links hovered, any links already visited hovered, any links with active state (mouseDown or actual page), any links that has browser focus */
}
a:focus {
    /* maybe you want to remove outline for this one */
}

当然,在清理你凌乱的 .css 之后试试这个

于 2013-03-14T22:50:03.447 回答