用不同的颜色定义每个链接状态伪类好吗?
我们是否应该始终使用所有这些具有不同颜色的伪选择器?
a:link { color: blue }
a:active { color: white;}
a:hover { color: white;}
a:visited {color:green;}
基本上我们为主要内容区域中的链接定义这些,但问题是它也覆盖了所有侧边栏链接、导航链接等,那么如果导航具有不同的配色方案,我们需要再次为导航链接创建所有定义?
更新: 另一个问题是,如果我们决定使用所有颜色,那么如何确定活动、悬停和访问的颜色,因为客户和设计师从不为所有颜色提供颜色。他们只提供链接的颜色
Should we always use all these pseudo selectors with different colors?
a:link { color: blue }
a:active { color: white;}
a:hover { color: white;}
a:visited {color:green;}
Basically we define these for links in the main content area, but then the problem is that it overrides all side bar links, navigation links, etc also, then we need to create define all again for navigation links if navigation has different color scheme?
Update:
And another problem is if we decide to use all then how to decide color for active, hover and visited because client and designer never provide color for all. they only provide color of link
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于您的导航问题,在大多数情况下,我会尽量避免为您网站上的相同元素(在本例中为 a)定义不同的配色方案/行为。
In regards to your nav question, I would, in most cases, try to avoid defining different color scheme's/behaviors for identical elements (in this case a) across your site.
没有必要。定义你想要定义的那些。让级联正常工作,让您高兴的事情发生。
在您描述的情况下,听起来您对这种情况的发生不感到高兴。因此,您应该为每种情况定义状态的样式。
顺便说一句……
:focus
通常也是一个好主意。:hover
效果应用于已访问和未访问的链接,因此:hover
应出现在:link
和:visited< 之后/code> 在源代码中(您可能不希望这样,但大多数人都这样做)
:hover
和:focus
之后定义:active
。There is no need. Define the ones you want to define. Allow the cascade to work as normal for the ones where you are happy for that to happen.
In the case you describe, it sounds like you are not happy for that to happen. So you should define styles for the states in each case.
As a few asides…
:focus
too.:hover
effects to apply to visited and unvisited links, so:hover
should appear after:link
and:visited
in the source (you might not want this, but most people do):active
after:hover
and:focus
.