返回   CHF站长论坛 > 综合讨论区 > 网站开发与设计

网站开发与设计 网页设计、网站开发、网站维护与调试交流区。

魔兽世界私服 奇迹私服 双至强仅二千,企商在线,最早租用商 亿恩1元帮您升级服务器! 江民杀毒软件2008年推广计划
传奇世界私服 传世私服 传奇私服 明网Linux合租空间,独立IP 全球最新的创意科技产品 魔域私服 传奇私服 魔域私服 完美世界私服
发表新主题 回复
 
主题工具 主题评分 显示模式
旧 2008-03-12, 17:11   #1 (页面定位)
wuhao
青铜长老
 
注册日期: 2006-05-23
帖子: 266
wuhao 是普普通通的会员
默认 请教XHTML的一个问题

就是导航拦,我设置连接颜色全部都是黑色,但有一个连接我想做成红色,我这么做的
<a href="#" class="red">aaa</a>

然后css里写 .red{color:red;}

但是不起效果,一般一堆连接,对某几个连接作用单独的效果该怎么做呀,

<a href="#" title="xxx"><font color=red>xxx(HOT)</font></a><br />这样虽然可以,但是不符合规范呀,请大家指教,请老鬼赐教!
wuhao 当前离线   回复时引用此帖
旧 2008-03-12, 17:23   #2 (页面定位)
wuhao
青铜长老
 
注册日期: 2006-05-23
帖子: 266
wuhao 是普普通通的会员
默认

HTML 代码:
<style>
a{color:#000}
.red {color:red;}
</style>
<a href="#" class="red">aaa</a>
<a href="#">aaa</a>
别人的貌似可以
wuhao 当前离线   回复时引用此帖
旧 2008-03-12, 17:36   #3 (页面定位)
wuhao
青铜长老
 
注册日期: 2006-05-23
帖子: 266
wuhao 是普普通通的会员
默认

问题解决

解决方法如下

没人回答偶也得把方法写上帮助后人,哈哈

<html>
<style>
a:link { color: #000;text-decoration: none;}
a:visited { color: #000;text-decoration: none;}
a:hover { color: #000; text-decoration: underline;}
a.b:link { color: #f00;text-decoration: none;}
a.b:visited { color: #f00;text-decoration: none;}
a.b:hover { color: #000; text-decoration: underline;}
</style>
<a href="#" class="b">aaa</a>
<a href="#">aaa</a>
</html>
wuhao 当前离线   回复时引用此帖
旧 2008-03-13, 14:35   #4 (页面定位)
流浪中……
 
注册日期: 2005-09-05
帖子: 145
风 是普普通通的会员
默认

定义的顺序问题吧。

一般针对元素的选择器,应该写在靠前的位置,特别的类选择器,定义在靠后,以覆盖之前的元素选择器的定义。
风 当前离线   回复时引用此帖
旧 2008-03-13, 22:55   #5 (页面定位)
zipo_han
 
zipo_han 的头像
 
注册日期: 2006-07-08
帖子: 94
zipo_han 是普普通通的会员
默认

<html>
<style>
a:link,a:visited { color: #000;text-decoration: none;}
a:hover {text-decoration: underline;}
a.b:link,a.b:visited { color: #f00;text-decoration: none;}
a.b:hover {text-decoration: underline;}
</style>
<a href="#" class="b">aaa</a>
<a href="#">aaa</a>
</html>


至少应该这么写的,


Where did you go? I choose noise.

UIcity
zipo_han 当前离线   回复时引用此帖
回复

书签

标签

主题工具
显示模式 对此主题评分
对此主题评分:



所有时间均为北京时间。现在的时间是 06:31