小编sun*_*wen的帖子

为什么<h1>中的<h2>不能继承color属性的值?

看看这个简单的例子:

<style>
   h1 {
      color: red;
   }
</style>

<h1>this is the 'h1'.<h2>this is the 'h2'</h2></h1>
Run Code Online (Sandbox Code Playgroud)

我预计'h2'内的字符串颜色为红色,但仍然是黑色.

这让我困惑了一段时间.为什么会这样?

html css

3
推荐指数
1
解决办法
172
查看次数

标签 统计

css ×1

html ×1