HTLM/CSS 和链接不改变颜色的问题

问题描述 投票:0回答:1

我开始学习 HTML,当我这样做时,我在我的第一个网站上测试它(我随机选择了一个主题,这样我就可以测试我学到的内容),我指定了我想要链接的颜色,但是当服务器运行时,保持橙色。 HTML:

<html lang="en-US">

<head>
   <meta charset="UTF-8">
   <meta name="author" content="Artur Braga">
   <meta name="description" content="This is a page about Albert Cammus and his philosophy(its alt+z+windows idiot)">
   <link rel="icon" href="html5.svg" type="image-x/icon"> 
   <title>My first web page</title>
   <link rel="stylesheet" href="main.css" type="text/css">


</head>

<body>
<section id="Albert Camus Life and History">
   <h1>THE ONLY GOOD FRENCH IN HISTORY</h1>
<hr>
<nav>
   <ul>
      <li>
         <a href="#Albert Camus Life and History">Life and History</a>
      </li>
      <li>
         <a href="#cycles">Cycles</a>
      </li>
   </ul>
</nav>
<hr>

   <!--Start with history and then talk about absurdism-->
   <h2>Who was Camus?</h2>
   <p>Camus was a French philosopher, author, dramatist, journalist and political activist. He was the recipient of the 1957 Nobel Prize in Literature at the age of 44, the second-youngest recipient in history.</p>

   <address>
      His works include The Stranger, The Plague<br>
      The Myth of Sisyphus, The Fall, and The Rebel..
   </address>

   <h3>Brief History</h3>
   <p>
      <strong> Camus was born in Algeria</strong> during the French colonization, to pied-noir parents. He spent his childhood in a poor neighbourhood and later studied philosophy at the <a href="https://en.wikipedia.org/wiki/Algiers_1_University"><em><abbr title="Also Called Algiers 1 University or Benyoucef Benkhedda">University of Algiers</abbr></em>.</a> He was in Paris when the Germans invaded France during World War II in 1940. Camus tried to flee but finally joined the French Resistance where he served as editor-in-chief at Combat, an outlawed newspaper. After the war, he was a celebrity figure and gave many lectures around the world. He married twice but had many extramarital affairs. Camus was politically active; he was part of the left that opposed Joseph Stalin and the Soviet Union because of their totalitarianism. Camus was a moralist and leaned towards anarcho-syndicalism. He was part of many organisations seeking European integration. During the Algerian War (1954–1962), he kept a neutral stance, advocating for a multicultural and pluralistic Algeria, a position that was rejected by most parties.
   </p>
    
   <h3>Camus Literary cicles</h3>
   <p>Camus separated his work into three cycles. Each cycle consisted of a novel, an essay, and a play. The first was the cycle of the absurd consisting of L'Étranger, Le Mythe de Sysiphe, and Caligula. The second was the cycle of the revolt which included La Peste (The Plague), L'Homme révolté (The Rebel), and Les Justes (The Just Assassins). The third, the cycle of the love, consisted of Nemesis. Each cycle was an examination of a theme with the use of a pagan myth and including biblical motifs.
      <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this is here just to showcase how to use blank spaces</p>

</section>

      
   <hr>

   <section id="cycles">
   <h2>Cycles and books</h2>

   <h3>Cycle of the absurd</h3>

   <ul>
   <li><p>L'Étranger</p></li>
   <li><p>Le Mythe de Sysiphe</p></li>
   <li><p>Caligula</p></li>
   </ul>



   <h3>Cycle of the revolt</h3>

   <ol>
     <li>...La Peste (The Plague),</li>
     <li>...L'Homme révolté (The Rebel)</li>
     <li>...<a href="about.html">Les Justes (The Just Assassins)</a></li>

   </ol>

   <h3>Cycle of the love</h3>
   
   <dl>
   <dt>Nemesis</dt>
   <dd>O Mito de nêmesis por Albert Camus</dd>
   </dl>

   </section>

   <hr>
&lt;&lt;&lt; &copy;Artur Braga &gt;&gt;&gt;
<p>
   <a href="#">back to top</a>
</p>
</body>




</html>

CSS:

html {
    font-size: 22px;
    }
    body{
       background-color: #333;
       color: whitesmoke;
    }

    a {
color: rgb(119, 168, 211);
    }

    a:visited {
      color: rgb(133, 33, 33)
    }
    
    a:hover, a:active, a:target {
      color:#ffffff;
    }

how the text looks

我已经将颜色更改为我可以清楚地看到它们是否改变的颜色,但它们没有改变。抱歉问了这个愚蠢的问题,这是我第一次使用这个平台。

html css colors
1个回答
0
投票

有时浏览器缓存可能会导致样式表无法立即更新。但你可以尝试给一个

class
id
来锚定标签,即
a
这样的东西它应该按预期工作

<a href="#" class="anchor">hello world</a>

.anchor{
  color: red
}
© www.soinside.com 2019 - 2024. All rights reserved.