试图覆盖html div中的链接样式但它不起作用

时间:2017-05-27 05:56:01

标签: html css

我对css编码比较陌生。我一直在网上寻求帮助,但我找不到任何有用的解决方案。我设置代码的时间最远,如下所示。

我在单个页面上输入CSS窗口的CSS代码是:



div.box_round_background {
          padding: 5px;
}

div.box_round {
          -moz-border-radius: 12px; /* FF1+ */
          -webkit-border-radius: 12px; /* Saf3-4 */
          border-radius: 12px; /* Opera 10.5, IE 9, Saf5, Chrome */
          background-color: #86ae30;
}



div.box_round h1 {
          color: #ffffff;
          padding: 20px;
}


a.box_round h1:link { color:#ffffff; text-decoration:none; font-weight:normal; }
a.box_round h1:visited { color: #e1efc3; text-decoration:none; font-weight:normal; }
a.box_round h1:hover { color: #5c7821; text-decoration:underline; font-weight:normal; }
a.box_round h1:active { color: #a4ce4b; text-decoration:none; font-weight:normal; }




我在html源代码中插入的代码是:



<div class="box_round_background">
   <div class="box_round">
	<a href="/web-design-services"><h1>Web Design Services</h1></a>
   </div>
</div>
&#13;
&#13;
&#13;

我没有得到链接颜色所需的结果。它根本没有对链接颜色产生太大影响。

任何人都可以帮我解决一下我可能做错了什么吗?谢谢!

2 个答案:

答案 0 :(得分:0)

尝试从

更改css选择器
    a.box_round h1:link
    a.box_round h1:visited
    a.box_round h1:hover
    a.box_round h1:active

    .box_round a:link h1
    .box_round a:visited h1
    .box_round a:hover h1
    .box_round a:active h1

答案 1 :(得分:0)

Css的工作时间越来越接近,所以当你说div.box_round h1h1代表.box_roud h1,但是在提供的代码中,a只有div.box_round_background { padding: 5px; } div.box_round { -moz-border-radius: 12px; /* FF1+ */ -webkit-border-radius: 12px; /* Saf3-4 */ border-radius: 12px; /* Opera 10.5, IE 9, Saf5, Chrome */ background-color: #86ae30; } div.box_round a { color: #ffffff; padding: 20px; } .box_round a:link { color:#ffffff; text-decoration:none; font-weight:normal; } .box_round a:visited { color: #e1efc3; text-decoration:none; font-weight:normal; } .box_round a:hover { color: #5c7821; text-decoration:underline; font-weight:normal; } .box_round a:active { color: #a4ce4b; text-decoration:none; font-weight:normal; } <div class="box_round_background"> <div class="box_round"> <a href="/web-design-services"><h1>Web Design Services</h1></a> </div> </div> 1}}标签。

所以你只需要通过以下方式更改h1:

&#13;
&#13;
{{1}}
&#13;
{{1}}
&#13;
&#13;
&#13;

相关问题