简体   繁体   English

CSS3选择器问题

[英]CSS3 selector issue

I'm creating my contact page for my portfolio website and I'm having some problems with selectors. 我正在为我的投资组合网站创建联系页面,而选择器出现了一些问题。 I have a good knowledge base of both HTML and CSS. 我拥有HTML和CSS的良好知识基础。 And I'm now making the transition to HTML5/CSS3. 现在,我正在过渡到HTML5 / CSS3。

I'm having a problem doing any modifications to the h2 on the page. 我在对页面上的h2进行任何修改时遇到问题。 It seems when I try and target the h2 in CSS it doesn't make any changes. 看来,当我尝试在CSS中定位h2时,并没有进行任何更改。 Am I missing something that needs to be added in because it's using HTML5 elements? 我是否因为使用HTML5元素而缺少一些需要添加的内容? Or am I just not using the correct DOM to the element to make changes? 还是我只是不对元素使用正确的DOM进行更改? Any help would be appreciated. 任何帮助,将不胜感激。

<!-- HTML5 -->
<section>
    <h2 class="pages">Contact</h2>
<article>
</article>
</section>

<!-- CSS3 -->
section h2 .pages
{

}

jsFiddle here. jsFiddle在这里。


Your selector is slightly wrong, use this instead: 您的选择器略有错误,请改用以下方法:

section h2.pages {
  color:red;
}

Edit: 编辑:

Files in relation to comments: 与评论有关的文件:

http://www.speedyshare.com/2eSXY/contact.php http://www.speedyshare.com/2eSXY/contact.php

http://www.speedyshare.com/Z5exc/screen.css.css http://www.speedyshare.com/Z5exc/screen.css.css

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM