diff --git a/8-web-components/6-shadow-dom-style/article.md b/8-web-components/6-shadow-dom-style/article.md index 2be81fbb21..60af219665 100644 --- a/8-web-components/6-shadow-dom-style/article.md +++ b/8-web-components/6-shadow-dom-style/article.md @@ -1,21 +1,21 @@ -# Shadow DOM styling +# 给 Shadow DOM 添加样式 -Shadow DOM may include both ` ``` -...Then the `` would be without padding. +……那么 `` 将没有 padding。 -It's very convenient, as we can setup "default" component styles in its `:host` rule, and then easily override them in the document. +这是非常有利的,因为我们可以在其 `:host` 规则中设置 “默认” 组件样式,然后在文档中轻松地覆盖它们。 -The exception is when a local property is labelled `!important`, for such properties, local styles take precedence. +唯一的例外是当局部属性被标记 `!important` 时,对于这样的属性,局部样式优先。 ## :host(selector) -Same as `:host`, but applied only if the shadow host matches the `selector`. +与 `:host` 相同,但仅在 shadow 宿主与 `selector` 匹配时才应用样式。 -For example, we'd like to center the `` only if it has `centered` attribute: +例如,我们希望仅当 `` 具有 `centered` 属性时才将其居中: ```html run autorun="no-epub" untrusted height=80