Styling Polymer Templates

Use Lit templates instead
Lit templates are recommended. Polymer templates are available in the next long term supported Vaadin version (LTS), but they are deprecated.

Since Polymer templates are Web Components, their content is inside shadow DOM. By design, shadow DOM defines a local style scope that is isolated from global styles. See Style Scopes for more information.

You can add component-specific scoped styles directly in the <style> tag in the template getter.

import { PolymerElement } from '@polymer/polymer/polymer-element.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';

class MyView extends PolymerElement {
  static get template() {
    return html`
        :host {
          /* Styles for the <my-view> host element */
          display: block;

        .my-view-title {
          font-weight: bold;
          border-bottom: 1px solid gray;
      <h2 class="my-view-title">My view title</h2>

  static get is() {
    return 'my-view';
customElements.define(, MyView);