Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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 嵌套的CSS ID可以在firefox中使用,但不能在IE8中使用?_Html_Css_Internet Explorer 8_Internet Explorer 7 - Fatal编程技术网

Html 嵌套的CSS ID可以在firefox中使用,但不能在IE8中使用?

Html 嵌套的CSS ID可以在firefox中使用,但不能在IE8中使用?,html,css,internet-explorer-8,internet-explorer-7,Html,Css,Internet Explorer 8,Internet Explorer 7,我有这样的html嵌套 <div id="content"> <div id="asection"> <h1>Some Text</h1> </div> </div> 除Internet Explorer 7/8外,所有浏览器都会按预期显示此选项 我仍在掌握CSS和浏览器兼容性的窍门,因此非常感谢任何额外的眼睛/专业技能。谢谢大家! 编辑: 我做了一笔财产 #asection .h1 {}

我有这样的html嵌套

<div id="content">
    <div id="asection">
        <h1>Some Text</h1>
    </div>
</div>
除Internet Explorer 7/8外,所有浏览器都会按预期显示此选项

我仍在掌握CSS和浏览器兼容性的窍门,因此非常感谢任何额外的眼睛/专业技能。谢谢大家!

编辑: 我做了一笔财产

#asection .h1 {} 
把原来h1的东西放在一起,它就成功了。
我还纠正了我在h1和h7上犯的一个错误,这是我在尝试使标记通用时犯的错误。

不需要
只需在
h1
前面加一个空格,点指向一个类,除非您有一个名为
h1
的类,即
class=“h1”
,否则这将无法按预期工作

因此,如果您试图在
#asection
中瞄准h1,则代码如下:

#asection h1 {} 
h1之前的时间段表示一个名为“h1”的类,而不是一个元素。要以元素h1为目标,只需按原样指定它


这在Firefox和IE8中应该是一样的;在这方面应该没有区别。

h7?但是这个标记有一个h1,我认为它只指向H6。你能说一下你得到了什么结果,它们与你的期望有什么不同吗?我发布的代码在IE8和Firefox中都给出了相同的结果。
#asection h1 {} 
#asection .h1 {}