Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 既然已经声明了类,为什么还要使用元素呢?_Html_Css_Class_Element - Fatal编程技术网

Html 既然已经声明了类,为什么还要使用元素呢?

Html 既然已经声明了类,为什么还要使用元素呢?,html,css,class,element,Html,Css,Class,Element,在css中,如果一个人已经声明了一个类,那么他为什么需要在声明之后使用元素,就像这样做有什么好处一样。例如: 元素中有一类“内容” 那么,以下两者之间css的区别是什么: .content h1{…} 和 .content{..}.content h1表示类为内容的所有元素中任何级别的子组件的任何h1标记,而.content指类为内容的元素

在css中,如果一个人已经声明了一个类,那么他为什么需要在声明之后使用元素,就像这样做有什么好处一样。例如: 元素中有一类“内容” 那么,以下两者之间css的区别是什么: .content h1{…} 和
.content{..}

.content h1
表示类为
内容的所有元素中任何级别的子组件的任何
h1
标记,而
.content
指类为
内容的元素