diff --git a/docs/_guide/styles.md b/docs/_guide/styles.md index d99c0ee9..0f19e0d9 100644 --- a/docs/_guide/styles.md +++ b/docs/_guide/styles.md @@ -12,9 +12,14 @@ slug: styles * ToC {:toc} -## Use the :host CSS pseudo-class +## Use the :host and :host() CSS pseudo-classes -In a style block, use the `:host` CSS pseudo-class to select the host element: +When styling your custom element, you can use the `:host` and `:host()` CSS pseudo-classes in a ` @@ -34,19 +40,19 @@ render() { {% include project.html folder="docs/style/hostselector" openFile="my-element.js" %} -See the MDN documentation on [:host](https://developer.mozilla.org/en-US/docs/Web/CSS/:host()) and [pseudo-classes](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) for more information. +See the MDN documentation on [:host](https://developer.mozilla.org/en-US/docs/Web/CSS/:host), [:host()](https://developer.mozilla.org/en-US/docs/Web/CSS/:host()), and [pseudo-classes](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) for more information. -### Set :host display styles +### Set host element display styles Two best practices for working with custom elements are: * Set a `:host` display style such as `block` or `inline-block` so that your component's `width` and `height` can be set. -* Set a `:host` display style that respects the `hidden` attribute. +* Set a `:host()` display style that respects the `hidden` attribute. ```html ``` @@ -248,7 +254,7 @@ _my-element.js_ render() { return html`
Hello world
diff --git a/docs/_includes/projects/docs/style/customproperties/my-element.js b/docs/_includes/projects/docs/style/customproperties/my-element.js index ea40d1eb..07e72b8d 100644 --- a/docs/_includes/projects/docs/style/customproperties/my-element.js +++ b/docs/_includes/projects/docs/style/customproperties/my-element.js @@ -4,7 +4,7 @@ class MyElement extends LitElement { render() { return html`