如何 select 内联样式中的子属性 html

How to select child attribute in inline style html

在 css 中可能是这样的:

<style type="text/css">
  section br {
    display:none;
  }
</style>

如何做到这一点,但在内嵌标签中,例如:

<section style="section br { display:none;}  ">
         <br />
         <br />
         <br />
         <br />
</section>

我的意图不是在某些特定部分内显示标签
,但我只能使用内联,在这种情况下不可能使用外部 css 或

内的标签

冷有人帮我,那就太好了!

简短的回答是:你不能那样做。

无法添加也可以应用于子项的内联样式。您可以参考 the style attribute spec (https://www.w3.org/TR/css-style-attr/),它简洁地(尽管有些隐晦)对其进行了解释。

The value of the style attribute must match the syntax of the contents of a CSS declaration block (excluding the delimiting braces)...

The declarations in a style attribute apply to the element to which the attribute belongs. In the cascade, these declarations are considered to have author origin and a specificity higher than any selector. CSS2.1 defines how style sheets and style attributes are cascaded together. [CSS21] Relative URLs in the style data must be resolved relative to the style attribute's element (or to the document if per-element resolution is not defined) when the attribute's value is parsed.

Aside from the differences in cascading, the declarations in a style attribute must be interpreted exactly as if they were given in a CSS style rule that applies to the element.