CSS中关于多个选择器中是否含有空格的区别_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:38:43
Original
1114 people have browsed it

CSS中关于多个选择器中是否含有空格的区别

CSS中多个选择器中含有空格和不含有空格区别很大,区分下列含义:

#header.callout { }#header .callout { }
Copy after login

第一个表示ID为header的同时类名为callout的选择器,
第二个表示ID为header下子节点中含有类名为callout的选择器

我们用以下例子表明:

#header.callout { }<div id="header" class="callout"></div>
Copy after login
#header .callout { }<div id="header" class="callout">    <div class="callout">    </div></div>
Copy after login

#header .callout { }中我们选择的是其中的类名为callout的子div。

版权声明:本文为博主原创文章,未经博主允许不得转载。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!