div 内的超链接,并在 HTML/CSS 中的标签内分配了一个类
目前,我正在尝试实现我的第一个 HTML5 应用程序,但我遇到了一些有关 HTML/CSS 的常见问题,特别是使用 header 标记。
通常我将主标签放在CSS规则的开头,因此我可以控制每个属性并且不混合它们中的任何一个。
现在我有这个 CSS 代码:
header div.followUs { float:right; font:Georgia, "Times New Roman", Times, serif; color:#B2B2B2; font-style:italic }
header div.followUs a,a:link,a:active,a:visited { color:orange }
header nav { clear:right; float:right; margin-top:20px }
header nav ul li { float:left; margin-right: 25px; text-transform:uppercase; font-weight:bold }
header nav ul li:last-child { margin-right: 0 }
header nav ul li a { text-decoration:none }
我的 HTML 代码是:
<header>
<div class="header-inner clearfix">
<h1 class="logo">Client KickOff</h1>
<div class="followUs">Segue-nos no <a href="#">Twitter</a> and <a href="#">Facebook</a>.</div>
<nav>
<ul>
<li><a href="/html/">Notícias</a></li>
<li><a href="/html5/">Quem Somos</a></li>
<li><a href="/css/">Os Nossos Produtos</a></li>
<li><a href="/css3/">O Nosso Portefólio</a></li>
<li><a href="/js/">Contacte-nos!</a></li>
</ul>
</nav>
</div>
</header>
它给出与 div 相同的颜色,并将 followUs 类应用于导航项。
有什么想法吗?
Currently I am trying to implement my first HTML5 application, but I am having some general issues regarding HTML/CSS, specially using header tag.
Usually I put the main tag at the beginning of the CSS rule, therefore I could control each property and to don't mix any of them.
Right now I have this CSS code:
header div.followUs { float:right; font:Georgia, "Times New Roman", Times, serif; color:#B2B2B2; font-style:italic }
header div.followUs a,a:link,a:active,a:visited { color:orange }
header nav { clear:right; float:right; margin-top:20px }
header nav ul li { float:left; margin-right: 25px; text-transform:uppercase; font-weight:bold }
header nav ul li:last-child { margin-right: 0 }
header nav ul li a { text-decoration:none }
And my HTML code is:
<header>
<div class="header-inner clearfix">
<h1 class="logo">Client KickOff</h1>
<div class="followUs">Segue-nos no <a href="#">Twitter</a> and <a href="#">Facebook</a>.</div>
<nav>
<ul>
<li><a href="/html/">Notícias</a></li>
<li><a href="/html5/">Quem Somos</a></li>
<li><a href="/css/">Os Nossos Produtos</a></li>
<li><a href="/css3/">O Nosso Portefólio</a></li>
<li><a href="/js/">Contacte-nos!</a></li>
</ul>
</nav>
</div>
</header>
It is giving the same color as the div with the followUs class applied to the navigation items.
Any ideias?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
字面意思是这样的:
因此导航中的链接与单个
a:link
规则匹配,因为它没有指定在 header 和 followUs 部分内。您需要在每个
a:
选择器前面添加header div.followUs
。不过,您应该删除额外的a:
选择器,因为初始header div.followUs a
已经涵盖了所有表单。will literally mean this:
So your links in the navigation are matching to the single
a:link
rule, since it is not specified to be within the header and followUs division.You need to have the
header div.followUs
in front of each of thea:
selectors. Although, you should just remove the extraa:
selectors because the initialheader div.followUs a
will already cover all forms.header div.followUs a,a:link,a:active,a:visited { color:orange }
这是问题所在您有一个链接设置为橙色,并且明显带有 li 标记您有链接,
删除 a:link
header div.followUs a,a:link,a:active,a:visited { color:orange }
here is the problemyou have a link set up to orange an clearly li tags you have links,
remove a:link