What is host property in css?

The :host pseudo-class selector is used to target styles in the element that hosts the component. Since the host element is in a parent component's template, you can't reach the host element from inside the component by other means. For example, you can create a border for parent element as below,

//Other styles for app.component.css
//...
:host {
display: block;
border: 1px solid black;
padding: 20px;
}

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter